You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-04 12:00:25 +00:00
Metal: Reduce baked version to MSL 3.1; validate minimum version
Validate the MSL version of the baked shader is <= the current version supported by the OS, and return an error so it is recompiled. Closes #109846
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user