diff --git a/src/dawn/native/d3d12/TextureD3D12.cpp b/src/dawn/native/d3d12/TextureD3D12.cpp index b86abbde80..95983551da 100644 --- a/src/dawn/native/d3d12/TextureD3D12.cpp +++ b/src/dawn/native/d3d12/TextureD3D12.cpp @@ -761,13 +761,27 @@ namespace dawn::native::d3d12 { StateAndDecay* state, D3D12_RESOURCE_STATES newState, ExecutionSerial pendingCommandSerial) const { - // Reuse the subresource(s) directly and avoid transition when it isn't needed, and - // return false. - if (state->lastState == newState) { + D3D12_RESOURCE_STATES lastState = state->lastState; + + // If the transition is from-UAV-to-UAV, then a UAV barrier is needed. + // If one of the usages isn't UAV, then other barriers are used. + bool needsUAVBarrier = lastState == D3D12_RESOURCE_STATE_UNORDERED_ACCESS && + newState == D3D12_RESOURCE_STATE_UNORDERED_ACCESS; + + if (needsUAVBarrier) { + D3D12_RESOURCE_BARRIER barrier; + barrier.Type = D3D12_RESOURCE_BARRIER_TYPE_UAV; + barrier.Flags = D3D12_RESOURCE_BARRIER_FLAG_NONE; + barrier.UAV.pResource = GetD3D12Resource(); + barriers->push_back(barrier); return; } - D3D12_RESOURCE_STATES lastState = state->lastState; + // Reuse the subresource(s) directly and avoid transition when it isn't needed, and + // return false. + if (lastState == newState) { + return; + } // The COMMON state represents a state where no write operations can be pending, and // where all pixels are uncompressed. This makes it possible to transition to and diff --git a/webgpu-cts/expectations.txt b/webgpu-cts/expectations.txt index 42446b7c3e..545ca7c3fa 100644 --- a/webgpu-cts/expectations.txt +++ b/webgpu-cts/expectations.txt @@ -573,8 +573,6 @@ crbug.com/dawn/0000 [ mac ] webgpu:api,validation,image_copy,layout_related:rows crbug.com/dawn/0000 [ mac ] webgpu:shader,execution,evaluation_order:assignment:name="ToArrayFromArray" [ RetryOnFailure ] crbug.com/dawn/0000 [ win ] webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,array:srcFormat="bc7-rgba-unorm-srgb";dstFormat="bc7-rgba-unorm";dimension="2d" [ RetryOnFailure ] crbug.com/dawn/0000 [ win ] webgpu:api,operation,command_buffer,copyTextureToTexture:color_textures,compressed,non_array:srcFormat="bc7-rgba-unorm-srgb";dstFormat="bc7-rgba-unorm-srgb";dimension="2d" [ RetryOnFailure ] -crbug.com/dawn/0000 [ win ] webgpu:api,operation,memory_sync,texture,same_subresource:ww:boundary="dispatch";first={"op":"storage","in":"compute-pass-encoder"};second={"op":"storage","in":"compute-pass-encoder"} [ RetryOnFailure ] -crbug.com/dawn/0000 [ win ] webgpu:api,operation,memory_sync,texture,same_subresource:ww:boundary="pass";first={"op":"storage","in":"compute-pass-encoder"};second={"op":"storage","in":"compute-pass-encoder"} [ RetryOnFailure ] crbug.com/dawn/0000 [ win ] webgpu:api,operation,rendering,indirect_draw:basics:isIndexed=true [ RetryOnFailure ] crbug.com/dawn/0000 [ win ] webgpu:api,operation,resource_init,buffer:index_buffer: [ RetryOnFailure ] crbug.com/dawn/0000 [ win ] webgpu:api,operation,vertex_state,correctness:setVertexBuffer_offset_and_attribute_offset:format="sint32x4" [ RetryOnFailure ]