Metal: Enable Toggle::ApplyClearBigIntegerColorValueWithDraw on Intel GPUs

This patch enables Toggle::ApplyClearBigIntegerColorValueWithDraw on
Metal backends using Intel GPUs to workaround an issue about clearing
int32 and uint32 formats with big integer values that cannot be represented
by float.

Bug: dawn:1109, dawn:1463
Test: dawn_end2end_tests
Change-Id: Idb77f57ea5909ad67fa2a79956634bacfc2a2e15
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/98480
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
This commit is contained in:
Jiawei Shao 2022-08-10 06:44:13 +00:00 committed by Dawn LUCI CQ
parent 76eeb828c8
commit 6f81e13a20
3 changed files with 11 additions and 44 deletions

View File

@ -302,7 +302,8 @@ static constexpr ToggleEnumAndInfoList kToggleNameAndInfoList = {{
"(> 2^24 or < -2^24 for signed integer formats) as the clear value of a color attachment "
"with 32-bit integer or unsigned integer formats because D3D12 APIs only support using "
"float numbers as clear values, while a float number cannot always precisely represent an "
"integer that is greater than 2^24 or smaller than -2^24).",
"integer that is greater than 2^24 or smaller than -2^24). This toggle is also enabled on "
"Intel GPUs on Metal backend due to a driver issue on Intel Metal driver.",
"https://crbug.com/dawn/537"}},
// Comment to separate the }} so it is clearer what to copy-paste to add a toggle.
}};

View File

@ -212,7 +212,7 @@ void Device::InitTogglesFromDriver() {
SetToggle(Toggle::MetalRenderR8RG8UnormSmallMipToTempTexture, true);
}
// On some Intel GPU vertex only render pipeline get wrong depth result if no fragment
// On some Intel GPUs vertex only render pipeline get wrong depth result if no fragment
// shader provided. Create a placeholder fragment shader module to work around this issue.
if (gpu_info::IsIntel(vendorId)) {
bool usePlaceholderFragmentShader = true;
@ -221,6 +221,14 @@ void Device::InitTogglesFromDriver() {
}
SetToggle(Toggle::UsePlaceholderFragmentInVertexOnlyPipeline, usePlaceholderFragmentShader);
}
// On some Intel GPUs using big integer values as clear values in render pass doesn't work
// correctly. Currently we have to add workaround for this issue by enabling the toggle
// "apply_clear_big_integer_color_value_with_draw". See https://crbug.com/dawn/1109 and
// https://crbug.com/dawn/1463 for more details.
if (gpu_info::IsIntel(vendorId)) {
SetToggle(Toggle::ApplyClearBigIntegerColorValueWithDraw, true);
}
}
ResultOrError<Ref<BindGroupBase>> Device::CreateBindGroupImpl(

View File

@ -235,13 +235,6 @@ TEST_P(RenderPassLoadOpTests, LoadOpClearOnIntegerFormats) {
// This test verifies that input double values are being rendered correctly when clearing.
TEST_P(RenderPassLoadOpTests, LoadOpClearIntegerFormatsToLargeValues) {
// TODO(crbug.com/dawn/1109): Re-enable once fixed on Mac Mini 8,1s w/ 11.5.
DAWN_SUPPRESS_TEST_IF(IsMetal() && IsIntel() && IsMacOS(11, 5));
// TODO(crbug.com/dawn/1463): Re-enable, might be the same as above just on
// 12.4 instead of 11.5.
DAWN_SUPPRESS_TEST_IF(IsMetal() && IsIntel() && IsMacOS(12, 4));
constexpr double kUint32MaxDouble = 4294967295.0;
constexpr uint32_t kUint32Max = static_cast<uint32_t>(kUint32MaxDouble);
// RGBA32Uint for UINT32_MAX
@ -385,13 +378,6 @@ TEST_P(RenderPassLoadOpTests, LoadOpClearIntegerFormatsOutOfBound_Sint16) {
// Test clearing a color attachment on Uint32 formats (R32Uint, RG32Uint, RGBA32Uint) when the clear
// values are out of bound.
TEST_P(RenderPassLoadOpTests, LoadOpClearIntegerFormatsOutOfBound_Uint32) {
// TODO(crbug.com/dawn/1109): Re-enable once fixed on Mac Mini 8,1s w/ 11.5.
DAWN_SUPPRESS_TEST_IF(IsMetal() && IsIntel() && IsMacOS(11, 5));
// TODO(crbug.com/dawn/1463): Re-enable, might be the same as above just on
// 12.4 instead of 11.5.
DAWN_SUPPRESS_TEST_IF(IsMetal() && IsIntel() && IsMacOS(12, 4));
constexpr uint64_t kUint32Max = std::numeric_limits<uint32_t>::max();
using TestCase = std::tuple<wgpu::TextureFormat, wgpu::Color, std::array<uint32_t, 4>>;
@ -416,13 +402,6 @@ TEST_P(RenderPassLoadOpTests, LoadOpClearIntegerFormatsOutOfBound_Uint32) {
// Test clearing a color attachment on Sint32 formats (R32Sint, RG32Sint, RGBA32Sint) when the clear
// values are out of bound.
TEST_P(RenderPassLoadOpTests, LoadOpClearIntegerFormatsOutOfBound_Sint32) {
// TODO(crbug.com/dawn/1109): Re-enable once fixed on Mac Mini 8,1s w/ 11.5.
DAWN_SUPPRESS_TEST_IF(IsMetal() && IsIntel() && IsMacOS(11, 5));
// TODO(crbug.com/dawn/1463): Re-enable, might be the same as above just on
// 12.4 instead of 11.5.
DAWN_SUPPRESS_TEST_IF(IsMetal() && IsIntel() && IsMacOS(12, 4));
constexpr int64_t kSint32Max = std::numeric_limits<int32_t>::max();
constexpr int64_t kSint32Min = std::numeric_limits<int32_t>::min();
@ -487,13 +466,6 @@ TEST_P(RenderPassLoadOpTests, LoadOpClearNormalizedFormatsOutOfBound) {
// Test clearing multiple color attachments with different big integers can still work correctly.
TEST_P(RenderPassLoadOpTests, LoadOpClearWithBigInt32ValuesOnMultipleColorAttachments) {
// TODO(crbug.com/dawn/1109): Re-enable once fixed on Mac Mini 8,1s w/ 11.5.
DAWN_SUPPRESS_TEST_IF(IsMetal() && IsIntel() && IsMacOS(11, 5));
// TODO(crbug.com/dawn/1463): Re-enable, might be the same as above just on
// 12.4 instead of 11.5.
DAWN_SUPPRESS_TEST_IF(IsMetal() && IsIntel() && IsMacOS(12, 4));
constexpr int32_t kMaxInt32RepresentableInFloat = 1 << std::numeric_limits<float>::digits;
constexpr int32_t kMinInt32RepresentableInFloat = -kMaxInt32RepresentableInFloat;
@ -582,13 +554,6 @@ TEST_P(RenderPassLoadOpTests, LoadOpClearWithBigInt32ValuesOnMultipleColorAttach
// Test clearing multiple color attachments with different big unsigned integers can still work
// correctly.
TEST_P(RenderPassLoadOpTests, LoadOpClearWithBigUInt32ValuesOnMultipleColorAttachments) {
// TODO(crbug.com/dawn/1109): Re-enable once fixed on Mac Mini 8,1s w/ 11.5.
DAWN_SUPPRESS_TEST_IF(IsMetal() && IsIntel() && IsMacOS(11, 5));
// TODO(crbug.com/dawn/1463): Re-enable, might be the same as above just on
// 12.4 instead of 11.5.
DAWN_SUPPRESS_TEST_IF(IsMetal() && IsIntel() && IsMacOS(12, 4));
constexpr int32_t kMaxUInt32RepresentableInFloat = 1 << std::numeric_limits<float>::digits;
using TestCase = std::tuple<wgpu::TextureFormat, wgpu::Color, std::array<uint32_t, 4>>;
@ -699,13 +664,6 @@ TEST_P(RenderPassLoadOpTests, LoadOpClearWithBigUInt32ValuesOnMultipleColorAttac
// Test using LoadOp::Clear with different big unsigned integers as clearValues and LoadOp::Load on
// the other color attachments in one render pass encoder works correctly.
TEST_P(RenderPassLoadOpTests, MixedUseOfLoadOpLoadAndLoadOpClearWithBigIntegerValues) {
// TODO(crbug.com/dawn/1109): Re-enable once fixed on Mac Mini 8,1s w/ 11.5.
DAWN_SUPPRESS_TEST_IF(IsMetal() && IsIntel() && IsMacOS(11, 5));
// TODO(crbug.com/dawn/1463): Re-enable, might be the same as above just on
// 12.4 instead of 11.5.
DAWN_SUPPRESS_TEST_IF(IsMetal() && IsIntel() && IsMacOS(12, 4));
constexpr int32_t kMaxUInt32RepresentableInFloat = 1 << std::numeric_limits<float>::digits;
wgpu::TextureDescriptor textureDescriptor = {};