diff --git a/src/dawn/native/Texture.cpp b/src/dawn/native/Texture.cpp index 521ad8bf90..98703e8965 100644 --- a/src/dawn/native/Texture.cpp +++ b/src/dawn/native/Texture.cpp @@ -750,14 +750,15 @@ bool TextureBase::IsMultisampledTexture() const { 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 42edacffaf..781ff600f1 100644 --- a/src/dawn/native/Texture.h +++ b/src/dawn/native/Texture.h @@ -80,7 +80,7 @@ class TextureBase : public ApiObjectBase { 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 79c3f20490..b2744b65bb 100644 --- a/src/dawn/native/d3d11/AdapterD3D11.cpp +++ b/src/dawn/native/d3d11/AdapterD3D11.cpp @@ -193,7 +193,10 @@ MaybeError Adapter::ValidateFeatureSupportedWithTogglesImpl(wgpu::FeatureName fe 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> 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 5ba4ee36bc..0aafc4051e 100644 --- a/src/dawn/native/d3d11/CommandBufferD3D11.cpp +++ b/src/dawn/native/d3d11/CommandBufferD3D11.cpp @@ -555,9 +555,10 @@ MaybeError CommandBuffer::ExecuteRenderPass(BeginRenderPassCmd* renderPass, 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 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 80c0e822c2..d7f84e41a6 100644 --- a/src/dawn/native/d3d11/TextureD3D11.cpp +++ b/src/dawn/native/d3d11/TextureD3D11.cpp @@ -578,8 +578,8 @@ MaybeError Texture::Copy(CommandRecordingContext* commandContext, CopyTextureToT 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 bfc71880f1..dbc095c859 100644 --- a/src/dawn/tests/end2end/RenderAttachmentTests.cpp +++ b/src/dawn/tests/end2end/RenderAttachmentTests.cpp @@ -76,6 +76,7 @@ TEST_P(RenderAttachmentTest, MoreFragmentOutputsThanAttachments) { } 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 d3e8e2f1fb..abdefab972 100644 --- a/src/dawn/tests/end2end/RenderBundleTests.cpp +++ b/src/dawn/tests/end2end/RenderBundleTests.cpp @@ -194,6 +194,7 @@ TEST_P(RenderBundleTest, BundleAndRenderPassCommands) { } 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 8eac3edaf6..f25f5fd037 100644 --- a/src/dawn/tests/end2end/RenderPassLoadOpTests.cpp +++ b/src/dawn/tests/end2end/RenderPassLoadOpTests.cpp @@ -714,6 +714,7 @@ TEST_P(RenderPassLoadOpTests, MixedUseOfLoadOpLoadAndLoadOpClearWithBigIntegerVa } 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 14e8d727e6..624578d494 100644 --- a/src/dawn/tests/end2end/RenderPassTests.cpp +++ b/src/dawn/tests/end2end/RenderPassTests.cpp @@ -166,6 +166,7 @@ TEST_P(RenderPassTest, NoCorrespondingFragmentShaderOutputs) { } DAWN_INSTANTIATE_TEST(RenderPassTest, + D3D11Backend(), D3D12Backend(), D3D12Backend({}, {"use_d3d12_render_pass"}), MetalBackend(), @@ -225,6 +226,7 @@ TEST_P(RenderPassTest_RegressionDawn1071, ClearLowestMipOfR8Unorm) { } DAWN_INSTANTIATE_TEST(RenderPassTest_RegressionDawn1071, + D3D11Backend(), D3D12Backend(), MetalBackend(), 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. 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 @@ TEST_P(RenderPassTest_RegressionDawn1389, ClearMultisubresourceAfterWriteDepth16 } DAWN_INSTANTIATE_TEST(RenderPassTest_RegressionDawn1389, + D3D11Backend(), D3D12Backend(), MetalBackend(), MetalBackend({"use_blit_for_buffer_to_depth_texture_copy"}),