mirror of
https://github.com/gfx-rs/wgpu.git
synced 2026-04-22 03:02:01 -04:00
metal: Set preserveInvariance for shader options
This enables invariance for metal, for stable vertex positions, which are useful for depth prepass and similiar things.
This commit is contained in:
committed by
Dzmitry Malyshau
parent
16edd91976
commit
99b3a6ebfb
@@ -979,6 +979,11 @@ impl super::PrivateCapabilities {
|
||||
supports_depth_clip_control: device
|
||||
.supports_feature_set(MTLFeatureSet::iOS_GPUFamily4_v1)
|
||||
|| os_is_mac,
|
||||
supports_preserve_invariance: if os_is_mac {
|
||||
Self::version_at_least(major, minor, 11, 0)
|
||||
} else {
|
||||
Self::version_at_least(major, minor, 13, 0)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -76,6 +76,10 @@ impl super::Device {
|
||||
let options = mtl::CompileOptions::new();
|
||||
options.set_language_version(self.shared.private_caps.msl_version);
|
||||
|
||||
if self.shared.private_caps.supports_preserve_invariance {
|
||||
options.set_preserve_invariance(true);
|
||||
}
|
||||
|
||||
let library = self
|
||||
.shared
|
||||
.device
|
||||
|
||||
@@ -229,6 +229,7 @@ struct PrivateCapabilities {
|
||||
supports_arrays_of_textures_write: bool,
|
||||
supports_mutability: bool,
|
||||
supports_depth_clip_control: bool,
|
||||
supports_preserve_invariance: bool,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
|
||||
Reference in New Issue
Block a user