Browse Source

metal: explicitly compile to metalsl 2.1

Alex Szpakowski 4 years ago
parent
commit
3accf51eb2
1 changed files with 7 additions and 1 deletions
  1. 7 1
      src/modules/graphics/metal/Shader.mm

+ 7 - 1
src/modules/graphics/metal/Shader.mm

@@ -621,8 +621,14 @@ void Shader::compileFromGLSLang(id<MTLDevice> device, const glslang::TProgram &p
 														  length:source.length()
 														  length:source.length()
 														encoding:NSUTF8StringEncoding];
 														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;
 			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)
 			if (library == nil && err != nil)
 			{
 			{
 				NSLog(@"errors: %@", err);
 				NSLog(@"errors: %@", err);