File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed
filament/backend/src/metal Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -111,9 +111,22 @@ bool isReady() const noexcept {
111111 id <MTLLibrary > library = nil ;
112112 switch (program.getShaderLanguage ()) {
113113 case ShaderLanguage::MSL: {
114- // By default, Metal uses the most recent language version.
115114 MTLCompileOptions * options = [MTLCompileOptions new ];
116115 options.fastMathEnabled = YES ;
116+ // The docs for MTLCompileOptions say that Metal uses the most
117+ // recent language version if it is not specified, but this is
118+ // not always true: it is possible for the environment to be set
119+ // up in a way where an older version is used by default. So we
120+ // explicitly set the minimum version we require.
121+ #if defined(FILAMENT_IOS)
122+ options.languageVersion = MTLLanguageVersion2_0 ;
123+ #else
124+ if (@available (macOS 11.0 , *)) {
125+ options.languageVersion = MTLLanguageVersion2_3;
126+ } else {
127+ options.languageVersion = MTLLanguageVersion2_2 ;
128+ }
129+ #endif
117130
118131 assert_invariant (source[source.size () - 1 ] == ' \0 ' );
119132 // the shader string is null terminated and the length includes the null character
You can’t perform that action at this time.
0 commit comments