Skip to content

Commit 5123ad2

Browse files
committed
Fixing a few issues around manual Metal device selection
1 parent 04dfc9e commit 5123ad2

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

Sources/Plasma/Apps/plClient/plClient.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2038,7 +2038,7 @@ void plClient::IDetectAudioVideoSettings()
20382038
devSel.Enumerate(fWindowHndl);
20392039
devSel.RemoveUnusableDevModes(true);
20402040

2041-
if (!devSel.GetDefault(&dmr))
2041+
if (!devSel.GetRequested(&dmr, devmode))
20422042
devmode = false;
20432043
hsG3DDeviceRecord *rec = (hsG3DDeviceRecord *)dmr.GetDevice();
20442044
const hsG3DDeviceMode *mode = dmr.GetMode();

Sources/Plasma/FeatureLib/pfMetalPipeline/plMetalDeviceLibraryLoader.mm

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
#include <Foundation/Foundation.h>
4444
#include <Metal/Metal.h>
4545
#include "plMetalDevice.h"
46+
#include "plPipeline/hsG3DDeviceSelector.h"
4647

4748
void plMetalDevice::LoadLibrary()
4849
{
@@ -53,15 +54,21 @@
5354
*/
5455

5556
NS::Error* error;
57+
// If we're Metal 3 compatible - load the Metal 3 shader library
5658
#ifdef METAL_3_SDK
5759
if (@available(macOS 12, iOS 15, *)) {
58-
if (fMetalDevice->supportsFamily(MTL::GPUFamilyMetal3)) {
60+
if (fDeviceType == hsG3DDeviceSelector::kDevTypeMetal3) {
5961
NSURL* shaderURL = [NSBundle.mainBundle URLForResource:@"pfMetalPipelineShadersMSL30" withExtension:@"metallib"];
6062
fShaderLibrary = fMetalDevice->newLibrary(static_cast<NS::URL*>(shaderURL), &error);
6163
return;
6264
}
6365
}
6466
#endif
67+
// Otherwise load the right Metal 2 shader library.
68+
// The MSL23 library is optimized for Apple Silicon. It will
69+
// still load on Intel Macs, but we need to be running at least
70+
// macOS 11. Intel Macs running older versions of macOS need to
71+
// run an MSL 2.1 version of the library.
6572
#ifdef TARGET_OS_OSX
6673
if (@available(macOS 11, iOS 14, *)) {
6774
NSURL* shaderURL = [NSBundle.mainBundle URLForResource:@"pfMetalPipelineShadersMSL23" withExtension:@"metallib"];

0 commit comments

Comments
 (0)