Merge pull request #110063 from stuartcarnie/109846/ios_crash

Metal: Reduce baked version to MSL 3.1; validate minimum version
This commit is contained in:
Thaddeus Crews 2025-09-01 19:09:56 -05:00
commit 280503b4ee
No known key found for this signature in database
GPG key ID: 8C6E5FEB5FC03CCC
3 changed files with 10 additions and 1 deletions

View file

@ -102,3 +102,7 @@ private:
extern os_log_t LOG_DRIVER;
// Used for dynamic tracing.
extern os_log_t LOG_INTERVALS;
_FORCE_INLINE_ static uint32_t make_msl_version(uint32_t major, uint32_t minor = 0, uint32_t patch = 0) {
return (major * 10000) + (minor * 100) + patch;
}

View file

@ -1137,6 +1137,11 @@ RDD::ShaderID RenderingDeviceDriverMetal::shader_create_from_container(const Ref
RDD::ShaderID(),
"Shader was generated with argument buffers, but device has limited support");
uint32_t msl_version = make_msl_version(device_properties->features.mslVersionMajor, device_properties->features.mslVersionMinor);
ERR_FAIL_COND_V_MSG(msl_version < mtl_reflection_data.msl_version,
RDD::ShaderID(),
"Shader was compiled with a newer version of Metal than is available on the device.");
MTLCompileOptions *options = [MTLCompileOptions new];
uint32_t major = mtl_reflection_data.msl_version / 10000;
uint32_t minor = (mtl_reflection_data.msl_version / 100) % 100;

View file

@ -79,7 +79,7 @@ const MetalDeviceProfile *MetalDeviceProfile::get_profile(MetalDeviceProfile::Pl
} break;
}
res.features.mslVersionMajor = 3;
res.features.mslVersionMinor = 2;
res.features.mslVersionMinor = 1;
}
return &profiles.insert(key, res)->value;