d3d11: enable render related end2end tests
Set Toggle::ApplyClearBigIntegerColorValueWithDraw for device,
since D3D11 can only clear RTV with float values. It workarounds
issues for clearing some RTV with really big integer values.
Bug: dawn:1705
Change-Id: I2e7ec7f527b9a41edc28a004f7989842c6ced3b7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/130600
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Peng Huang <penghuang@chromium.org>
diff --git a/src/dawn/native/Texture.cpp b/src/dawn/native/Texture.cpp
index 521ad8b..98703e8 100644
--- a/src/dawn/native/Texture.cpp
+++ b/src/dawn/native/Texture.cpp
@@ -750,14 +750,15 @@
return mSampleCount > 1;
}
-bool TextureBase::CoverFullSubresource(const Extent3D& size) const {
+bool TextureBase::CoverFullSubresource(uint32_t mipLevel, const Extent3D& size) const {
+ Extent3D levelSize = GetMipLevelSingleSubresourcePhysicalSize(mipLevel);
switch (GetDimension()) {
case wgpu::TextureDimension::e1D:
- return size.width == GetSize().width;
+ return size.width == levelSize.width;
case wgpu::TextureDimension::e2D:
- return size.width == GetSize().width && size.height == GetSize().height;
+ return size.width == levelSize.width && size.height == levelSize.height;
case wgpu::TextureDimension::e3D:
- return size == GetSize();
+ return size == levelSize;
}
}
diff --git a/src/dawn/native/Texture.h b/src/dawn/native/Texture.h
index 42edacf..781ff60 100644
--- a/src/dawn/native/Texture.h
+++ b/src/dawn/native/Texture.h
@@ -80,7 +80,7 @@
bool IsMultisampledTexture() const;
// Returns true if the size covers the whole subresource.
- bool CoverFullSubresource(const Extent3D& size) const;
+ bool CoverFullSubresource(uint32_t mipLevel, const Extent3D& size) const;
// For a texture with non-block-compressed texture format, its physical size is always equal
// to its virtual size. For a texture with block compressed texture format, the physical
diff --git a/src/dawn/native/d3d11/AdapterD3D11.cpp b/src/dawn/native/d3d11/AdapterD3D11.cpp
index 79c3f20..b2744b6 100644
--- a/src/dawn/native/d3d11/AdapterD3D11.cpp
+++ b/src/dawn/native/d3d11/AdapterD3D11.cpp
@@ -193,7 +193,10 @@
return {};
}
-void Adapter::SetupBackendDeviceToggles(TogglesState* deviceToggles) const {}
+void Adapter::SetupBackendDeviceToggles(TogglesState* deviceToggles) const {
+ // D3D11 can only clear RTV with float values.
+ deviceToggles->Default(Toggle::ApplyClearBigIntegerColorValueWithDraw, true);
+}
ResultOrError<Ref<DeviceBase>> Adapter::CreateDeviceImpl(const DeviceDescriptor* descriptor,
const TogglesState& deviceToggles) {
diff --git a/src/dawn/native/d3d11/CommandBufferD3D11.cpp b/src/dawn/native/d3d11/CommandBufferD3D11.cpp
index 5ba4ee3..0aafc40 100644
--- a/src/dawn/native/d3d11/CommandBufferD3D11.cpp
+++ b/src/dawn/native/d3d11/CommandBufferD3D11.cpp
@@ -555,9 +555,10 @@
DAWN_TRY_ASSIGN(d3d11RenderTargetViews[i], colorTextureView->CreateD3D11RenderTargetView());
d3d11RenderTargetViewPtrs[i] = d3d11RenderTargetViews[i].Get();
if (renderPass->colorAttachments[i].loadOp == wgpu::LoadOp::Clear) {
- d3d11DeviceContext1->ClearRenderTargetView(
- d3d11RenderTargetViews[i].Get(),
- ConvertToFloatColor(renderPass->colorAttachments[i].clearColor).data());
+ std::array<float, 4> clearColor =
+ ConvertToFloatColor(renderPass->colorAttachments[i].clearColor);
+ d3d11DeviceContext1->ClearRenderTargetView(d3d11RenderTargetViews[i].Get(),
+ clearColor.data());
}
attachmentCount = i;
attachmentCount++;
diff --git a/src/dawn/native/d3d11/TextureD3D11.cpp b/src/dawn/native/d3d11/TextureD3D11.cpp
index 80c0e82..d7f84e4 100644
--- a/src/dawn/native/d3d11/TextureD3D11.cpp
+++ b/src/dawn/native/d3d11/TextureD3D11.cpp
@@ -578,8 +578,8 @@
UNREACHABLE();
}
- bool isWholeSubresource = src.texture->CoverFullSubresource(copy->copySize);
-
+ bool isWholeSubresource = src.texture->CoverFullSubresource(src.mipLevel, copy->copySize) &&
+ dst.texture->CoverFullSubresource(dst.mipLevel, copy->copySize);
// Partial update subresource of a depth/stencil texture is not allowed.
ASSERT(isWholeSubresource || !src.texture->GetFormat().HasDepthOrStencil());
diff --git a/src/dawn/tests/end2end/RenderAttachmentTests.cpp b/src/dawn/tests/end2end/RenderAttachmentTests.cpp
index bfc7188..dbc095c 100644
--- a/src/dawn/tests/end2end/RenderAttachmentTests.cpp
+++ b/src/dawn/tests/end2end/RenderAttachmentTests.cpp
@@ -76,6 +76,7 @@
}
DAWN_INSTANTIATE_TEST(RenderAttachmentTest,
+ D3D11Backend(),
D3D12Backend(),
D3D12Backend({}, {"use_d3d12_render_pass"}),
MetalBackend(),
diff --git a/src/dawn/tests/end2end/RenderBundleTests.cpp b/src/dawn/tests/end2end/RenderBundleTests.cpp
index d3e8e2f..abdefab 100644
--- a/src/dawn/tests/end2end/RenderBundleTests.cpp
+++ b/src/dawn/tests/end2end/RenderBundleTests.cpp
@@ -194,6 +194,7 @@
}
DAWN_INSTANTIATE_TEST(RenderBundleTest,
+ D3D11Backend(),
D3D12Backend(),
MetalBackend(),
OpenGLBackend(),
diff --git a/src/dawn/tests/end2end/RenderPassLoadOpTests.cpp b/src/dawn/tests/end2end/RenderPassLoadOpTests.cpp
index 8eac3ed..f25f5fd 100644
--- a/src/dawn/tests/end2end/RenderPassLoadOpTests.cpp
+++ b/src/dawn/tests/end2end/RenderPassLoadOpTests.cpp
@@ -714,6 +714,7 @@
}
DAWN_INSTANTIATE_TEST(RenderPassLoadOpTests,
+ D3D11Backend(),
D3D12Backend(),
MetalBackend(),
OpenGLBackend(),
diff --git a/src/dawn/tests/end2end/RenderPassTests.cpp b/src/dawn/tests/end2end/RenderPassTests.cpp
index 14e8d72..624578d 100644
--- a/src/dawn/tests/end2end/RenderPassTests.cpp
+++ b/src/dawn/tests/end2end/RenderPassTests.cpp
@@ -166,6 +166,7 @@
}
DAWN_INSTANTIATE_TEST(RenderPassTest,
+ D3D11Backend(),
D3D12Backend(),
D3D12Backend({}, {"use_d3d12_render_pass"}),
MetalBackend(),
@@ -225,6 +226,7 @@
}
DAWN_INSTANTIATE_TEST(RenderPassTest_RegressionDawn1071,
+ D3D11Backend(),
D3D12Backend(),
MetalBackend(),
MetalBackend({"metal_render_r8_rg8_unorm_small_mip_to_temp_texture"}),
@@ -239,6 +241,9 @@
// TODO(crbug.com/dawn/1492): Support copying to Depth16Unorm on GL.
DAWN_SUPPRESS_TEST_IF(IsOpenGL() || IsOpenGLES());
+ // TODO(dawn:1705): fix this test for Intel D3D11.
+ DAWN_SUPPRESS_TEST_IF(IsD3D11() && IsIntel());
+
// Test all combinatons of multi-mip, multi-layer
for (uint32_t mipLevelCount : {1, 5}) {
for (uint32_t arrayLayerCount : {1, 7}) {
@@ -359,6 +364,7 @@
}
DAWN_INSTANTIATE_TEST(RenderPassTest_RegressionDawn1389,
+ D3D11Backend(),
D3D12Backend(),
MetalBackend(),
MetalBackend({"use_blit_for_buffer_to_depth_texture_copy"}),