Skip to content

Commit

Permalink
Using Metal 2.1 shader library on iOS
Browse files Browse the repository at this point in the history
  • Loading branch information
colincornaby committed Apr 18, 2024
1 parent fbcb402 commit ff3076c
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,22 @@

void plMetalDevice::LoadLibrary()
{
/*
On iOS we're fine loading the Metal 2.1 library. Metal 2.1 includes
all the Apple Silicon features on iOS. We need Metal 2.3 to get those
features on macOS.
*/

NS::Error* error;

#ifdef TARGET_MACOS
if (@available(macOS 11, *))
{
NSURL* shaderURL = [NSBundle.mainBundle URLForResource:@"pfMetalPipelineShadersMSL23" withExtension:@"metallib"];
fShaderLibrary = fMetalDevice->newLibrary(static_cast<NS::URL*>(shaderURL), &error);
}
else
#endif
{
NSURL* shaderURL = [NSBundle.mainBundle URLForResource:@"pfMetalPipelineShadersMSL21" withExtension:@"metallib"];
fShaderLibrary = fMetalDevice->newLibrary(static_cast<NS::URL*>(shaderURL), &error);
Expand Down

0 comments on commit ff3076c

Please sign in to comment.