Do MTL feature check for Depth Clamping (#1933)

* Do MTL feature check for Depth Clamping

(cherry picked from commit ae6e83c3b2e695918ffcd8bbf7ce3a1b32e2b36e)

# Conflicts:
#	wgpu-hal/src/metal/adapter.rs

* make feature support check conform

* clean code

* avoid same featureset checks multiple times

* cargo fmt'ed
This commit is contained in:
Geert Bleyen
2021-09-10 15:45:25 +02:00
committed by GitHub
parent bbb9968297
commit cc91b38301
2 changed files with 6 additions and 1 deletions

View File

@@ -850,6 +850,9 @@ impl super::PrivateCapabilities {
} else {
Self::version_at_least(major, minor, 11, 0)
},
//Depth clipping is supported on all macOS GPU families and iOS family 4 and later
supports_depth_clamping: device.supports_feature_set(MTLFeatureSet::iOS_GPUFamily4_v1)
|| os_is_mac,
}
}
@@ -857,7 +860,6 @@ impl super::PrivateCapabilities {
use wgt::Features as F;
let mut features = F::empty()
| F::DEPTH_CLAMPING
| F::TEXTURE_COMPRESSION_BC
| F::MAPPABLE_PRIMARY_BUFFERS
| F::VERTEX_WRITABLE_STORAGE
@@ -865,6 +867,8 @@ impl super::PrivateCapabilities {
| F::POLYGON_MODE_LINE
| F::CLEAR_COMMANDS;
features.set(F::DEPTH_CLAMPING, self.supports_depth_clamping);
features.set(
F::TEXTURE_BINDING_ARRAY
| F::SAMPLED_TEXTURE_AND_STORAGE_BUFFER_ARRAY_NON_UNIFORM_INDEXING

View File

@@ -222,6 +222,7 @@ struct PrivateCapabilities {
supports_arrays_of_textures: bool,
supports_arrays_of_textures_write: bool,
supports_mutability: bool,
supports_depth_clamping: bool,
}
#[derive(Clone, Debug)]