From 0ecfece609ec769acd3da4f4fde55ab1f0a12769 Mon Sep 17 00:00:00 2001 From: Corentin Wallez Date: Wed, 30 Jun 2021 09:57:04 +0000 Subject: [PATCH] Metal: make (robustness AND tint) => vertex pulling Tint's vertex pulling transform supports the whole GPUVertexState so we can enable it by default when robustness is necessary. Adds a suppression for failing tests on Metal Intel. Bug: dawn:805 Bug: dawn:966 Change-Id: Id7b2c6df2291671164647f65fc50c61e27de90b9 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/56382 Auto-Submit: Corentin Wallez Reviewed-by: Ben Clayton Commit-Queue: Corentin Wallez --- src/dawn_native/metal/DeviceMTL.mm | 10 ++++++---- src/tests/end2end/DrawIndexedIndirectTests.cpp | 8 ++++++++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/dawn_native/metal/DeviceMTL.mm b/src/dawn_native/metal/DeviceMTL.mm index ea7e09c514..0c392321ff 100644 --- a/src/dawn_native/metal/DeviceMTL.mm +++ b/src/dawn_native/metal/DeviceMTL.mm @@ -127,10 +127,6 @@ namespace dawn_native { namespace metal { MaybeError Device::Initialize() { InitTogglesFromDriver(); - if (!IsRobustnessEnabled()) { - ForceSetToggle(Toggle::MetalEnableVertexPulling, false); - } - mCommandQueue.Acquire([*mMtlDevice newCommandQueue]); if (GetAdapter()->GetSupportedExtensions().IsEnabled(Extension::TimestampQuery)) { @@ -189,6 +185,12 @@ namespace dawn_native { namespace metal { SetToggle(Toggle::DisableBaseInstance, !haveBaseVertexBaseInstance); } + // Vertex buffer robustness is implemented by using programmable vertex pulling. Enable + // that code path if it isn't explicitly disabled. + if (IsToggleEnabled(Toggle::UseTintGenerator) && IsRobustnessEnabled()) { + SetToggle(Toggle::MetalEnableVertexPulling, true); + } + // TODO(crbug.com/dawn/846): tighten this workaround when the driver bug is fixed. SetToggle(Toggle::AlwaysResolveIntoZeroLevelAndLayer, true); diff --git a/src/tests/end2end/DrawIndexedIndirectTests.cpp b/src/tests/end2end/DrawIndexedIndirectTests.cpp index 44b8c07bf5..147d5122cb 100644 --- a/src/tests/end2end/DrawIndexedIndirectTests.cpp +++ b/src/tests/end2end/DrawIndexedIndirectTests.cpp @@ -125,6 +125,10 @@ TEST_P(DrawIndexedIndirectTest, BaseVertex) { DAWN_TEST_UNSUPPORTED_IF(IsOpenGL()); DAWN_TEST_UNSUPPORTED_IF(IsOpenGLES()); + // TODO(crbug.com/dawn/966): Fails on Metal Intel, likely because [[builtin(vertex_index)]] + // doesn't take into account BaseVertex, which breaks programmable vertex pulling. + DAWN_SUPPRESS_TEST_IF(IsMetal() && IsIntel()); + RGBA8 filled(0, 255, 0, 255); RGBA8 notFilled(0, 0, 0, 0); @@ -150,6 +154,10 @@ TEST_P(DrawIndexedIndirectTest, IndirectOffset) { // TODO(crbug.com/dawn/789): Test is failing after a roll on SwANGLE on Windows only. DAWN_SUPPRESS_TEST_IF(IsANGLE() && IsWindows()); + // TODO(crbug.com/dawn/966): Fails on Metal Intel, likely because [[builtin(vertex_index)]] + // doesn't take into account BaseVertex, which breaks programmable vertex pulling. + DAWN_SUPPRESS_TEST_IF(IsMetal() && IsIntel()); + RGBA8 filled(0, 255, 0, 255); RGBA8 notFilled(0, 0, 0, 0);