Skip to content

Commit

Permalink
Adds feature detection for Metal.
Browse files Browse the repository at this point in the history
  • Loading branch information
Lichtso authored and exrook committed Oct 23, 2023
1 parent 9e6fdd8 commit 64603cb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
10 changes: 10 additions & 0 deletions wgpu-hal/src/metal/adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -800,6 +800,12 @@ impl super::PrivateCapabilities {
None
},
timestamp_query_support,
supports_simd_scoped_operations: family_check
&& (device.supports_family(MTLGPUFamily::Metal3)
|| device.supports_family(MTLGPUFamily::Mac2)
|| device.supports_family(MTLGPUFamily::Apple7)
|| device.supports_family(MTLGPUFamily::Apple8)
|| device.supports_family(MTLGPUFamily::Apple9)),
}
}

Expand Down Expand Up @@ -878,6 +884,10 @@ impl super::PrivateCapabilities {
features.set(F::RG11B10UFLOAT_RENDERABLE, self.format_rg11b10_all);
features.set(F::SHADER_UNUSED_VERTEX_OUTPUT, true);

if self.supports_simd_scoped_operations {
features.insert(F::SUBGROUP_OPERATIONS);
}

features
}

Expand Down
1 change: 1 addition & 0 deletions wgpu-hal/src/metal/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ struct PrivateCapabilities {
supports_shader_primitive_index: bool,
has_unified_memory: Option<bool>,
timestamp_query_support: TimestampQuerySupport,
supports_simd_scoped_operations: bool,
}

#[derive(Clone, Debug)]
Expand Down

0 comments on commit 64603cb

Please sign in to comment.