From b4425f537c9a2809689c35bc98955defb311f6eb Mon Sep 17 00:00:00 2001 From: jchen10 Date: Tue, 9 May 2023 01:25:25 +0000 Subject: [PATCH] d3d11: enable FirstIndexOffsetTests Bug: dawn:1803 Bug: dawn:1705 Change-Id: I54ee08aa79da6c37c4c9b70db1f815d2d52e7756 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131940 Commit-Queue: Jie A Chen Reviewed-by: Corentin Wallez Kokoro: Kokoro Reviewed-by: Peng Huang Reviewed-by: Austin Eng --- .../native/d3d11/BindGroupTrackerD3D11.cpp | 18 +++++++++++++++--- .../tests/end2end/FirstIndexOffsetTests.cpp | 1 + 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/dawn/native/d3d11/BindGroupTrackerD3D11.cpp b/src/dawn/native/d3d11/BindGroupTrackerD3D11.cpp index 571ad41e0e..b7628cdbe7 100644 --- a/src/dawn/native/d3d11/BindGroupTrackerD3D11.cpp +++ b/src/dawn/native/d3d11/BindGroupTrackerD3D11.cpp @@ -169,11 +169,17 @@ MaybeError BindGroupTracker::ApplyBindGroup(BindGroupIndex index) { } case wgpu::BufferBindingType::Storage: case kInternalStorageBufferBinding: { - ASSERT(IsSubset(bindingInfo.visibility, wgpu::ShaderStage::Compute)); + ASSERT(IsSubset(bindingInfo.visibility, + wgpu::ShaderStage::Fragment | wgpu::ShaderStage::Compute)); ComPtr d3d11UAV; DAWN_TRY_ASSIGN( d3d11UAV, ToBackend(binding.buffer) ->CreateD3D11UnorderedAccessView1(offset, binding.size)); + if (bindingInfo.visibility & wgpu::ShaderStage::Fragment) { + deviceContext1->OMSetRenderTargetsAndUnorderedAccessViews( + D3D11_KEEP_RENDER_TARGETS_AND_DEPTH_STENCIL, nullptr, nullptr, + bindingSlot, 1, d3d11UAV.GetAddressOf(), nullptr); + } if (bindingInfo.visibility & wgpu::ShaderStage::Compute) { deviceContext1->CSSetUnorderedAccessViews( bindingSlot, 1, d3d11UAV.GetAddressOf(), nullptr); @@ -279,9 +285,15 @@ void BindGroupTracker::UnApplyBindGroup(BindGroupIndex index) { } case wgpu::BufferBindingType::Storage: case kInternalStorageBufferBinding: { - ASSERT(IsSubset(bindingInfo.visibility, wgpu::ShaderStage::Compute)); + ASSERT(IsSubset(bindingInfo.visibility, + wgpu::ShaderStage::Fragment | wgpu::ShaderStage::Compute)); + ID3D11UnorderedAccessView* nullUAV = nullptr; + if (bindingInfo.visibility & wgpu::ShaderStage::Fragment) { + deviceContext1->OMSetRenderTargetsAndUnorderedAccessViews( + D3D11_KEEP_RENDER_TARGETS_AND_DEPTH_STENCIL, nullptr, nullptr, + bindingSlot, 1, &nullUAV, nullptr); + } if (bindingInfo.visibility & wgpu::ShaderStage::Compute) { - ID3D11UnorderedAccessView* nullUAV = nullptr; deviceContext1->CSSetUnorderedAccessViews(bindingSlot, 1, &nullUAV, nullptr); } diff --git a/src/dawn/tests/end2end/FirstIndexOffsetTests.cpp b/src/dawn/tests/end2end/FirstIndexOffsetTests.cpp index ccb05290f4..29b0dcf87f 100644 --- a/src/dawn/tests/end2end/FirstIndexOffsetTests.cpp +++ b/src/dawn/tests/end2end/FirstIndexOffsetTests.cpp @@ -322,6 +322,7 @@ TEST_P(FirstIndexOffsetTests, IndexedIndirectBothOffset) { } DAWN_INSTANTIATE_TEST(FirstIndexOffsetTests, + D3D11Backend(), D3D12Backend(), MetalBackend(), OpenGLBackend(),