metal: explicitly compile to metalsl 2.1

This commit is contained in:
Alex Szpakowski
2021-04-02 18:10:46 -03:00
parent 9acf7df8e8
commit 3accf51eb2
+7 -1
View File
@@ -621,8 +621,14 @@ void Shader::compileFromGLSLang(id<MTLDevice> device, const glslang::TProgram &p
length:source.length()
encoding:NSUTF8StringEncoding];
MTLCompileOptions *opts = [MTLCompileOptions new];
// Silences warning. We already only use metal on these OS versions.
if (@available(macOS 10.14, iOS 12.0, *))
opts.languageVersion = MTLLanguageVersion2_1;
NSError *err = nil;
id<MTLLibrary> library = [device newLibraryWithSource:nssource options:nil error:&err];
id<MTLLibrary> library = [device newLibraryWithSource:nssource options:opts error:&err];
if (library == nil && err != nil)
{
NSLog(@"errors: %@", err);