Add informational toggle that sample mask is broken on Mac Intel

Bug: dawn:1462
Change-Id: Ifec68914edb7d0f7eaf90e066491a0af3fe7b232
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/114400
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
Austin Eng 2022-12-16 16:54:42 +00:00 committed by Dawn LUCI CQ
parent 5082727e55
commit e48253f31e
4 changed files with 32 additions and 8 deletions

View File

@ -332,6 +332,12 @@ static constexpr ToggleEnumAndInfoList kToggleNameAndInfoList = {{
"This toggle is off by default. It is expected to turn on or get removed when WebGPU V1 "
"ships and stays stable.",
"https://crbug.com/dawn/1563"}},
{Toggle::NoWorkaroundSampleMaskBecomesZeroForAllButLastColorTarget,
{"no_workaround_sample_mask_becomes_zero_for_all_but_last_color_target",
"MacOS 12.0+ Intel has a bug where the sample mask is only applied for the last color "
"target. If there are multiple color targets, all but the last one will use a sample mask "
"of zero.",
"https://crbug.com/dawn/1462"}}
// Comment to separate the }} so it is clearer what to copy-paste to add a toggle.
}};
} // anonymous namespace

View File

@ -84,6 +84,9 @@ enum class Toggle {
D3D12Allocate2DTexturewithCopyDstAsCommittedResource,
DisallowDeprecatedAPIs,
// Unresolved issues.
NoWorkaroundSampleMaskBecomesZeroForAllButLastColorTarget,
EnumCount,
InvalidEnum = EnumCount,
};

View File

@ -257,6 +257,15 @@ void Device::InitTogglesFromDriver() {
if (@available(macos 11.0, iOS 14.0, *)) {
SetToggle(Toggle::MetalUseMockBlitEncoderForWriteTimestamp, true);
}
#if DAWN_PLATFORM_IS(MACOS)
if (gpu_info::IsIntel(vendorId)) {
if ([NSProcessInfo.processInfo
isOperatingSystemAtLeastVersion:NSOperatingSystemVersion{12, 0, 0}]) {
ForceSetToggle(Toggle::NoWorkaroundSampleMaskBecomesZeroForAllButLastColorTarget, true);
}
}
#endif
}
ResultOrError<Ref<BindGroupBase>> Device::CreateBindGroupImpl(

View File

@ -643,9 +643,6 @@ TEST_P(MultisampledRenderingTest, ResolveInto2DTextureWithEmptyFinalSampleMask)
// Test doing MSAA resolve into multiple resolve targets works correctly with a non-default sample
// mask.
TEST_P(MultisampledRenderingTest, ResolveIntoMultipleResolveTargetsWithSampleMask) {
// TODO(crbug.com/dawn/1462): Re-enable on Mac Intel 12.4.
DAWN_SUPPRESS_TEST_IF(IsMetal() && IsIntel() && (IsMacOS(12, 4) || IsMacOS(12, 5)));
// TODO(dawn:1550) Fails on ARM-based Android devices.
DAWN_SUPPRESS_TEST_IF(IsAndroid() && IsARM());
@ -682,7 +679,13 @@ TEST_P(MultisampledRenderingTest, ResolveIntoMultipleResolveTargetsWithSampleMas
wgpu::CommandBuffer commandBuffer = commandEncoder.Finish();
queue.Submit(1, &commandBuffer);
VerifyResolveTarget(kRed, mResolveTexture, 0, 0, kMSAACoverage);
// TODO(crbug.com/dawn/1462): Work around that a sample mask of zero is used for all
// color targets except the last one.
VerifyResolveTarget(
HasToggleEnabled("no_workaround_sample_mask_becomes_zero_for_all_but_last_color_target")
? wgpu::Color{}
: kRed,
mResolveTexture, 0, 0, kMSAACoverage);
VerifyResolveTarget(kGreen, resolveTexture2, 0, 0, kMSAACoverage);
}
@ -812,9 +815,6 @@ TEST_P(MultisampledRenderingTest, ResolveIntoMultipleResolveTargetsWithShaderOut
// supported on some platforms.
DAWN_TEST_UNSUPPORTED_IF(HasToggleEnabled("disable_sample_variables"));
// TODO(crbug.com/dawn/1462): Re-enable on Mac Intel 12.4.
DAWN_SUPPRESS_TEST_IF(IsMetal() && IsIntel() && (IsMacOS(12, 4) || IsMacOS(12, 5)));
wgpu::TextureView multisampledColorView2 =
CreateTextureForRenderAttachment(kColorFormat, kSampleCount).CreateView();
wgpu::Texture resolveTexture2 = CreateTextureForRenderAttachment(kColorFormat, 1);
@ -866,7 +866,13 @@ TEST_P(MultisampledRenderingTest, ResolveIntoMultipleResolveTargetsWithShaderOut
wgpu::CommandBuffer commandBuffer = commandEncoder.Finish();
queue.Submit(1, &commandBuffer);
VerifyResolveTarget(kRed, mResolveTexture, 0, 0, kMSAACoverage);
// TODO(crbug.com/dawn/1462): Work around that a sample mask of zero is used for all
// color targets except the last one.
VerifyResolveTarget(
HasToggleEnabled("no_workaround_sample_mask_becomes_zero_for_all_but_last_color_target")
? wgpu::Color{}
: kRed,
mResolveTexture, 0, 0, kMSAACoverage);
VerifyResolveTarget(kGreen, resolveTexture2, 0, 0, kMSAACoverage);
}