Advertisement

ID3D12GraphicsCommandList::ResourceBarrier validation

Started by November 01, 2017 05:03 AM
3 comments, last by SoldierOfLight 7 years, 3 months ago

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??

To answer my own question: Within a single command list, I'm performing an "A->B" followed by "A->C" transition. So, it makes perfect sense for the validation layer to flag the second transition as never-possibly-valid and the first as possibly-valid-depending-on-when-the-list-is-executed...

Advertisement

Hi Hodgman,

If you are using NVIDIA Gfx card then it might be the latest driver from them that is doing this.

I had similar experience where code used to work and then suddenly started to crash on one of my machines. I spent a lot of time wondering why it was working on one machine and not the other. And why it had stopped working on a machine that used to execute the code without any problems.

After going one step back on NVIDIA driver on the machine causing headaches it worked again.

/Kim

In this specific case it looks like you've called ResourceBarrier twice in the same command list. Going based off of:


does not match with the state (0x80: D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE) specified in the previous call to ResourceBarrier

It's possible that validation got better, but as far as I'm aware, it should've always been able to catch this particular case.

This topic is closed to new replies.

Advertisement