From d20945d8c190eb9c9fed296b64fdc532649a6b3a Mon Sep 17 00:00:00 2001 From: Frederik Vestre Date: Thu, 3 Aug 2023 21:55:07 +0200 Subject: [PATCH] Support feature detection on mac/metal for extended blending --- wgpu-hal/src/metal/adapter.rs | 4 +++- wgpu-hal/src/metal/mod.rs | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/wgpu-hal/src/metal/adapter.rs b/wgpu-hal/src/metal/adapter.rs index 5e44a18164d..153f897f23e 100644 --- a/wgpu-hal/src/metal/adapter.rs +++ b/wgpu-hal/src/metal/adapter.rs @@ -773,9 +773,10 @@ impl super::PrivateCapabilities { } else { None }, - support_timestamp_query: version.at_least((11, 0), (14, 0), os_is_mac) + support_timestamp_query: version.at_least((12, 0), (11, 0), os_is_mac) && device .supports_counter_sampling(metal::MTLCounterSamplingPoint::AtStageBoundary), + blend_func_extended: version.at_least((11, 0), (14, 0), os_is_mac), support_timestamp_query_in_passes: version.at_least((11, 0), (14, 0), os_is_mac) && device.supports_counter_sampling(metal::MTLCounterSamplingPoint::AtDrawBoundary) && device @@ -807,6 +808,7 @@ impl super::PrivateCapabilities { | F::DEPTH32FLOAT_STENCIL8 | F::MULTI_DRAW_INDIRECT; + features.set(F::BLEND_FUNC_EXTENDED , self.blend_func_extended); features.set(F::TIMESTAMP_QUERY, self.support_timestamp_query); // TODO: Not yet implemented. // features.set( diff --git a/wgpu-hal/src/metal/mod.rs b/wgpu-hal/src/metal/mod.rs index 3a8ebc5570a..30b6120e8b1 100644 --- a/wgpu-hal/src/metal/mod.rs +++ b/wgpu-hal/src/metal/mod.rs @@ -239,6 +239,7 @@ struct PrivateCapabilities { has_unified_memory: Option, support_timestamp_query: bool, support_timestamp_query_in_passes: bool, + blend_func_extended: bool, } #[derive(Clone, Debug)]