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 <jie.a.chen@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Peng Huang <penghuang@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
This commit is contained in:
jchen10 2023-05-09 01:25:25 +00:00 committed by Dawn LUCI CQ
parent 3912f57afc
commit b4425f537c
2 changed files with 16 additions and 3 deletions

View File

@ -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<ID3D11UnorderedAccessView> 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));
if (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) {
deviceContext1->CSSetUnorderedAccessViews(bindingSlot, 1, &nullUAV,
nullptr);
}

View File

@ -322,6 +322,7 @@ TEST_P(FirstIndexOffsetTests, IndexedIndirectBothOffset) {
}
DAWN_INSTANTIATE_TEST(FirstIndexOffsetTests,
D3D11Backend(),
D3D12Backend(),
MetalBackend(),
OpenGLBackend(),