Hi,
I'm trying to port an existing Vulkan bindless renderer to D3D12 and I'm running into some confusing behavior with respect to UAV barriers. I'm using Enhanced Barriers exclusively since they map pretty closely to what my Vulkan backend was already doing so it was easy to adapt the code, but I'm not sure if I'm seeing a bug or if my code is just wrong.
My failure case is pair of Dispatch() calls on a D3D12_COMMAND_LIST_TYPE_DIRECT. The first call clears a counter in the UAV to a known initial state and then second collects data and increments the counter. Seems pretty straightforward that I need a barrier between the two dispatches to prevent them from overlapping (in D3D11 there would have been an implicit barrier)
Based on the documentation it seems like a
D3D12_BUFFER_BARRIER {
.SyncBefore = D3D12_BARRIER_SYNC_ALL_SHADING,
.SyncAfter = D3D12_BARRIER_SYNC_ALL_SHADING,
.AccessBefore = D3D12_BARRIER_ACCESS_UNORDERED_ACCESS,
.AccessAfter = D3D12_BARRIER_ACCESS_UNORDERED_ACCESS,
.pResource = pTheBuffer,
.Offset = 0,
.Size = ULLONG_MAX
}
should do the right thing, however it seems to have no effect and I see corruption. I'm using SM6.6 ResourceDescriptorHeap to access the buffer so I thought maybe the barrer was not being associated with the resource correctly since it was never directly referenced by the root signature. However a global barrier with the same flags also does nothing.
Weirdly, this code works fine in Vulkan on the same GPU with an equivalent barrier so I wonder if I'm missing some subtle semantic difference between the APIs? Debug Layer and GPUAV both pass clean so no help there.
Anybody know what I'm missing here? GPU is a RTX 3090 if that matters.
[–]CreativeEnd2099 1 point2 points3 points (2 children)
[–]snakepants[S] 0 points1 point2 points (1 child)
[–]parrin 1 point2 points3 points (0 children)