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>
This commit is contained in:
parent
e4877b7e68
commit
765cdc283a
|
@ -750,14 +750,15 @@ bool TextureBase::IsMultisampledTexture() const {
|
||||||
return mSampleCount > 1;
|
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()) {
|
switch (GetDimension()) {
|
||||||
case wgpu::TextureDimension::e1D:
|
case wgpu::TextureDimension::e1D:
|
||||||
return size.width == GetSize().width;
|
return size.width == levelSize.width;
|
||||||
case wgpu::TextureDimension::e2D:
|
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:
|
case wgpu::TextureDimension::e3D:
|
||||||
return size == GetSize();
|
return size == levelSize;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -80,7 +80,7 @@ class TextureBase : public ApiObjectBase {
|
||||||
bool IsMultisampledTexture() const;
|
bool IsMultisampledTexture() const;
|
||||||
|
|
||||||
// Returns true if the size covers the whole subresource.
|
// 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
|
// 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
|
// to its virtual size. For a texture with block compressed texture format, the physical
|
||||||
|
|
|
@ -193,7 +193,10 @@ MaybeError Adapter::ValidateFeatureSupportedWithTogglesImpl(wgpu::FeatureName fe
|
||||||
return {};
|
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,
|
ResultOrError<Ref<DeviceBase>> Adapter::CreateDeviceImpl(const DeviceDescriptor* descriptor,
|
||||||
const TogglesState& deviceToggles) {
|
const TogglesState& deviceToggles) {
|
||||||
|
|
|
@ -555,9 +555,10 @@ MaybeError CommandBuffer::ExecuteRenderPass(BeginRenderPassCmd* renderPass,
|
||||||
DAWN_TRY_ASSIGN(d3d11RenderTargetViews[i], colorTextureView->CreateD3D11RenderTargetView());
|
DAWN_TRY_ASSIGN(d3d11RenderTargetViews[i], colorTextureView->CreateD3D11RenderTargetView());
|
||||||
d3d11RenderTargetViewPtrs[i] = d3d11RenderTargetViews[i].Get();
|
d3d11RenderTargetViewPtrs[i] = d3d11RenderTargetViews[i].Get();
|
||||||
if (renderPass->colorAttachments[i].loadOp == wgpu::LoadOp::Clear) {
|
if (renderPass->colorAttachments[i].loadOp == wgpu::LoadOp::Clear) {
|
||||||
d3d11DeviceContext1->ClearRenderTargetView(
|
std::array<float, 4> clearColor =
|
||||||
d3d11RenderTargetViews[i].Get(),
|
ConvertToFloatColor(renderPass->colorAttachments[i].clearColor);
|
||||||
ConvertToFloatColor(renderPass->colorAttachments[i].clearColor).data());
|
d3d11DeviceContext1->ClearRenderTargetView(d3d11RenderTargetViews[i].Get(),
|
||||||
|
clearColor.data());
|
||||||
}
|
}
|
||||||
attachmentCount = i;
|
attachmentCount = i;
|
||||||
attachmentCount++;
|
attachmentCount++;
|
||||||
|
|
|
@ -578,8 +578,8 @@ MaybeError Texture::Copy(CommandRecordingContext* commandContext, CopyTextureToT
|
||||||
UNREACHABLE();
|
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.
|
// Partial update subresource of a depth/stencil texture is not allowed.
|
||||||
ASSERT(isWholeSubresource || !src.texture->GetFormat().HasDepthOrStencil());
|
ASSERT(isWholeSubresource || !src.texture->GetFormat().HasDepthOrStencil());
|
||||||
|
|
||||||
|
|
|
@ -76,6 +76,7 @@ TEST_P(RenderAttachmentTest, MoreFragmentOutputsThanAttachments) {
|
||||||
}
|
}
|
||||||
|
|
||||||
DAWN_INSTANTIATE_TEST(RenderAttachmentTest,
|
DAWN_INSTANTIATE_TEST(RenderAttachmentTest,
|
||||||
|
D3D11Backend(),
|
||||||
D3D12Backend(),
|
D3D12Backend(),
|
||||||
D3D12Backend({}, {"use_d3d12_render_pass"}),
|
D3D12Backend({}, {"use_d3d12_render_pass"}),
|
||||||
MetalBackend(),
|
MetalBackend(),
|
||||||
|
|
|
@ -194,6 +194,7 @@ TEST_P(RenderBundleTest, BundleAndRenderPassCommands) {
|
||||||
}
|
}
|
||||||
|
|
||||||
DAWN_INSTANTIATE_TEST(RenderBundleTest,
|
DAWN_INSTANTIATE_TEST(RenderBundleTest,
|
||||||
|
D3D11Backend(),
|
||||||
D3D12Backend(),
|
D3D12Backend(),
|
||||||
MetalBackend(),
|
MetalBackend(),
|
||||||
OpenGLBackend(),
|
OpenGLBackend(),
|
||||||
|
|
|
@ -714,6 +714,7 @@ TEST_P(RenderPassLoadOpTests, MixedUseOfLoadOpLoadAndLoadOpClearWithBigIntegerVa
|
||||||
}
|
}
|
||||||
|
|
||||||
DAWN_INSTANTIATE_TEST(RenderPassLoadOpTests,
|
DAWN_INSTANTIATE_TEST(RenderPassLoadOpTests,
|
||||||
|
D3D11Backend(),
|
||||||
D3D12Backend(),
|
D3D12Backend(),
|
||||||
MetalBackend(),
|
MetalBackend(),
|
||||||
OpenGLBackend(),
|
OpenGLBackend(),
|
||||||
|
|
|
@ -166,6 +166,7 @@ TEST_P(RenderPassTest, NoCorrespondingFragmentShaderOutputs) {
|
||||||
}
|
}
|
||||||
|
|
||||||
DAWN_INSTANTIATE_TEST(RenderPassTest,
|
DAWN_INSTANTIATE_TEST(RenderPassTest,
|
||||||
|
D3D11Backend(),
|
||||||
D3D12Backend(),
|
D3D12Backend(),
|
||||||
D3D12Backend({}, {"use_d3d12_render_pass"}),
|
D3D12Backend({}, {"use_d3d12_render_pass"}),
|
||||||
MetalBackend(),
|
MetalBackend(),
|
||||||
|
@ -225,6 +226,7 @@ TEST_P(RenderPassTest_RegressionDawn1071, ClearLowestMipOfR8Unorm) {
|
||||||
}
|
}
|
||||||
|
|
||||||
DAWN_INSTANTIATE_TEST(RenderPassTest_RegressionDawn1071,
|
DAWN_INSTANTIATE_TEST(RenderPassTest_RegressionDawn1071,
|
||||||
|
D3D11Backend(),
|
||||||
D3D12Backend(),
|
D3D12Backend(),
|
||||||
MetalBackend(),
|
MetalBackend(),
|
||||||
MetalBackend({"metal_render_r8_rg8_unorm_small_mip_to_temp_texture"}),
|
MetalBackend({"metal_render_r8_rg8_unorm_small_mip_to_temp_texture"}),
|
||||||
|
@ -239,6 +241,9 @@ TEST_P(RenderPassTest_RegressionDawn1389, ClearMultisubresourceAfterWriteDepth16
|
||||||
// TODO(crbug.com/dawn/1492): Support copying to Depth16Unorm on GL.
|
// TODO(crbug.com/dawn/1492): Support copying to Depth16Unorm on GL.
|
||||||
DAWN_SUPPRESS_TEST_IF(IsOpenGL() || IsOpenGLES());
|
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
|
// Test all combinatons of multi-mip, multi-layer
|
||||||
for (uint32_t mipLevelCount : {1, 5}) {
|
for (uint32_t mipLevelCount : {1, 5}) {
|
||||||
for (uint32_t arrayLayerCount : {1, 7}) {
|
for (uint32_t arrayLayerCount : {1, 7}) {
|
||||||
|
@ -359,6 +364,7 @@ TEST_P(RenderPassTest_RegressionDawn1389, ClearMultisubresourceAfterWriteDepth16
|
||||||
}
|
}
|
||||||
|
|
||||||
DAWN_INSTANTIATE_TEST(RenderPassTest_RegressionDawn1389,
|
DAWN_INSTANTIATE_TEST(RenderPassTest_RegressionDawn1389,
|
||||||
|
D3D11Backend(),
|
||||||
D3D12Backend(),
|
D3D12Backend(),
|
||||||
MetalBackend(),
|
MetalBackend(),
|
||||||
MetalBackend({"use_blit_for_buffer_to_depth_texture_copy"}),
|
MetalBackend({"use_blit_for_buffer_to_depth_texture_copy"}),
|
||||||
|
|
Loading…
Reference in New Issue