Add D3D12 UAV barriers between multiple storage texture usages

Fixed: dawn:1370
Change-Id: I395b3e6e2506608ca4aefdbcef18443b90ca75ea
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/87302
Reviewed-by: Brandon Jones <bajones@chromium.org>
Reviewed-by: Loko Kung <lokokung@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
This commit is contained in:
Austin Eng 2022-04-19 20:51:40 +00:00 committed by Dawn LUCI CQ
parent b02535557e
commit 89d6a1f376
2 changed files with 18 additions and 6 deletions

View File

@ -761,13 +761,27 @@ namespace dawn::native::d3d12 {
StateAndDecay* state, StateAndDecay* state,
D3D12_RESOURCE_STATES newState, D3D12_RESOURCE_STATES newState,
ExecutionSerial pendingCommandSerial) const { ExecutionSerial pendingCommandSerial) const {
// Reuse the subresource(s) directly and avoid transition when it isn't needed, and D3D12_RESOURCE_STATES lastState = state->lastState;
// return false.
if (state->lastState == newState) { // 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; 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 // 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 // where all pixels are uncompressed. This makes it possible to transition to and

View File

@ -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 [ 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,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,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,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,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 ] crbug.com/dawn/0000 [ win ] webgpu:api,operation,vertex_state,correctness:setVertexBuffer_offset_and_attribute_offset:format="sint32x4" [ RetryOnFailure ]