From e3b510e4629d4cb6563026c716e5788570f044db Mon Sep 17 00:00:00 2001 From: Kai Ninomiya Date: Tue, 5 Nov 2019 15:56:05 +0000 Subject: [PATCH] Enable EmulateStoreAndMSAAResolve correctly by platform Fixes the accidental disabling of the workaround on 10.11, where it is required, and implements detection for iOS. Bug: dawn:253, dawn:56 Change-Id: I0278f29892d3a49144b5e9620e4377e42a4a5155 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12960 Reviewed-by: Jiawei Shao Reviewed-by: Corentin Wallez Commit-Queue: Corentin Wallez --- src/dawn_native/metal/DeviceMTL.mm | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/dawn_native/metal/DeviceMTL.mm b/src/dawn_native/metal/DeviceMTL.mm index a63c5214cd..8f52fe837c 100644 --- a/src/dawn_native/metal/DeviceMTL.mm +++ b/src/dawn_native/metal/DeviceMTL.mm @@ -77,15 +77,18 @@ namespace dawn_native { namespace metal { } void Device::InitTogglesFromDriver() { + { + bool haveStoreAndMSAAResolve = false; #if defined(DAWN_PLATFORM_MACOS) - if (@available(macOS 10.12, *)) { - bool emulateStoreAndMSAAResolve = - ![mMtlDevice supportsFeatureSet:MTLFeatureSet_macOS_GPUFamily1_v2]; - SetToggle(Toggle::EmulateStoreAndMSAAResolve, emulateStoreAndMSAAResolve); - } + haveStoreAndMSAAResolve = + [mMtlDevice supportsFeatureSet:MTLFeatureSet_macOS_GPUFamily1_v2]; +#elif defined(DAWN_PLATFORM_IOS) + haveStoreAndMSAAResolve = + [mMtlDevice supportsFeatureSet:MTLFeatureSet_iOS_GPUFamily3_v2]; #endif - - // TODO(jiawei.shao@intel.com): check iOS feature sets + // On tvOS, we would need MTLFeatureSet_tvOS_GPUFamily2_v1. + SetToggle(Toggle::EmulateStoreAndMSAAResolve, !haveStoreAndMSAAResolve); + } // TODO(jiawei.shao@intel.com): tighten this workaround when the driver bug is fixed. SetToggle(Toggle::AlwaysResolveIntoZeroLevelAndLayer, true);