mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-06-02 04:31:26 +00:00
Add Toggle to disable sampler compare function on Metal.
This Toggle is set if MTLFeatureSet_iOS_GPUFamily3_v1 is not supported. Bug: dawn:342 Change-Id: Ia5f43e87fdd2c13eaffe9557cb0ce9a06dec3b29 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16180 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:
parent
227568451b
commit
2f0f850da8
@ -102,6 +102,10 @@ namespace dawn_native {
|
|||||||
"backend will use D32S8 (toggle to on) but setting the toggle to off will make it"
|
"backend will use D32S8 (toggle to on) but setting the toggle to off will make it"
|
||||||
"use the D24S8 format when possible.",
|
"use the D24S8 format when possible.",
|
||||||
"https://crbug.com/dawn/286"}},
|
"https://crbug.com/dawn/286"}},
|
||||||
|
{Toggle::MetalDisableSamplerCompare,
|
||||||
|
{"metal_disable_sampler_compare",
|
||||||
|
"Disables the use of sampler compare on Metal. This is unsupported before A9 "
|
||||||
|
"processors."}},
|
||||||
}};
|
}};
|
||||||
|
|
||||||
} // anonymous namespace
|
} // anonymous namespace
|
||||||
|
@ -36,6 +36,7 @@ namespace dawn_native {
|
|||||||
UseSpvc,
|
UseSpvc,
|
||||||
UseSpvcParser,
|
UseSpvcParser,
|
||||||
VulkanUseD32S8,
|
VulkanUseD32S8,
|
||||||
|
MetalDisableSamplerCompare,
|
||||||
|
|
||||||
EnumCount,
|
EnumCount,
|
||||||
InvalidEnum = EnumCount,
|
InvalidEnum = EnumCount,
|
||||||
|
@ -69,6 +69,13 @@ namespace dawn_native { namespace metal {
|
|||||||
#endif
|
#endif
|
||||||
// On tvOS, we would need MTLFeatureSet_tvOS_GPUFamily2_v1.
|
// On tvOS, we would need MTLFeatureSet_tvOS_GPUFamily2_v1.
|
||||||
SetToggle(Toggle::EmulateStoreAndMSAAResolve, !haveStoreAndMSAAResolve);
|
SetToggle(Toggle::EmulateStoreAndMSAAResolve, !haveStoreAndMSAAResolve);
|
||||||
|
|
||||||
|
bool haveSamplerCompare = true;
|
||||||
|
#if defined(DAWN_PLATFORM_IOS)
|
||||||
|
haveSamplerCompare = [mMtlDevice supportsFeatureSet:MTLFeatureSet_iOS_GPUFamily3_v1];
|
||||||
|
#endif
|
||||||
|
// TODO(crbug.com/dawn/342): Investigate emulation -- possibly expensive.
|
||||||
|
SetToggle(Toggle::MetalDisableSamplerCompare, !haveSamplerCompare);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(jiawei.shao@intel.com): tighten this workaround when the driver bug is fixed.
|
// TODO(jiawei.shao@intel.com): tighten this workaround when the driver bug is fixed.
|
||||||
|
@ -52,15 +52,11 @@ namespace dawn_native { namespace metal {
|
|||||||
|
|
||||||
// static
|
// static
|
||||||
ResultOrError<Sampler*> Sampler::Create(Device* device, const SamplerDescriptor* descriptor) {
|
ResultOrError<Sampler*> Sampler::Create(Device* device, const SamplerDescriptor* descriptor) {
|
||||||
#if defined(DAWN_PLATFORM_IOS)
|
|
||||||
if (descriptor->compare != wgpu::CompareFunction::Never &&
|
if (descriptor->compare != wgpu::CompareFunction::Never &&
|
||||||
![device->GetMTLDevice() supportsFeatureSet:MTLFeatureSet_iOS_GPUFamily3_v1]) {
|
device->IsToggleEnabled(Toggle::MetalDisableSamplerCompare)) {
|
||||||
// Unsupported before A9.
|
return DAWN_VALIDATION_ERROR("Sampler compare function not supported.");
|
||||||
// TODO(b/149025333): Investigate emulation -- possibly expensive.
|
|
||||||
return DAWN_VALIDATION_ERROR(
|
|
||||||
"Sampler compare function requires at least iOS GPU family 3, version 1");
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
return new Sampler(device, descriptor);
|
return new Sampler(device, descriptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user