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 <jiawei.shao@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Kai Ninomiya 2019-11-05 15:56:05 +00:00 committed by Commit Bot service account
parent 0558f99119
commit e3b510e462
1 changed files with 10 additions and 7 deletions

View File

@ -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);