I've had a D3D12 implementaiton sitting in the background for a long time, but I only periodically check on it to see if it's still working (after windows/driver/etc updates). Today I checked it for the first time in many months, and ID3D12GraphicsCommandList::ResourceBarrier is causing validation errors:
D3D12 ERROR: ID3D12CommandList::ResourceBarrier: Before state (0x10: D3D12_RESOURCE_STATE_DEPTH_WRITE) of resource (0x00000279584EFB40:'depth') (subresource: 0) specified by transition barrier does not match with the state (0x80: D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE) specified in the previous call to ResourceBarrier [ RESOURCE_MANIPULATION ERROR #527: RESOURCE_BARRIER_BEFORE_AFTER_MISMATCH]
Six months ago my code was working fine without any errors, and now I get these errors (and if I ignore them, I get corrupt rendering that looks like cache invalidation/flush issues -- bad transitions)... This is probably due to windows/d3d validation getting better and catching bugs in my code that it wasn't before... but...
What I'm wondering is how is that particular function able to know the previous state of a resource during command recording?
For example, let's say I have one resource that starts in state "A", and I:
Record command list #1: Swap from "B" to "C".
Record command list #2: Swap from "C" to "A".
Record command list #3: Swap from "A" to "B".
Then let's say I execute list #3, then list #1, then list #2
This will correctly transition from "A"->"B"->"C"->"A"... but during recording, it looked like we were going to incorrectly do B->C (from A), C->A (from C), A->B (from A)...
It seems like I should get RESOURCE_BARRIER_BEFORE_AFTER_MISMATCH errors only when I execute a command list, not when I record one... Am I wrong??
↧