Advertisement

Resource State Promotion Issue

Started by January 03, 2020 07:49 AM
3 comments, last by austin.kinross 5 years ago

Can anyone move this to “Graphics and GPU Programming”? I submit to wrong forum and can not hide this. Sorry :(

The init State of Dest is D3D12_RESOURCE_STATE_UNORDERED_ACCESS,

In my first approch, I wrote:

Transition Dst to D3D12_RESOURCE_STATE_COPY_DEST
DX12Cmdlist→CopyResource(Dst, Src);

PIX gave me Perf hint like this:

Perf Hint,  False positives?

If I removed the transition before copyresource, I got runtime DX12 error:

D3D12 ERROR: ID3D12CommandQueue::ExecuteCommandLists: Using CopyResource on Command List (0x000001421176B7D0:'Unnamed ID3D12GraphicsCommandList Object'): Resource state (0x8: D3D12_RESOURCE_STATE_UNORDERED_ACCESS) of resource (0x000001423C96C140:'Dst') (subresource: 0) is invalid for use as a destination resource.  Expected State Bits (all): 0x400: D3D12_RESOURCE_STATE_COPY_DEST, Actual State: 0x8: D3D12_RESOURCE_STATE_UNORDERED_ACCESS, Missing State: 0x400: D3D12_RESOURCE_STATE_COPY_DEST. [ EXECUTION ERROR #538: INVALID_SUBRESOURCE_STATE]

I read this https://docs.microsoft.com/en-us/windows/win32/direct3d12/using-resource-barriers-to-synchronize-resource-states-in-direct3d-12,

but not understand it. What is the meaning of “Promotion”? It will change resource state? Or just keep the resource's state, don't need to transition its states explicitly?

Hi there! I work on the PIX team at Microsoft. I suspect you're right and this is a false positive in PIX.

To confirm my suspicions, is the resource a buffer? If so, did you use the buffer in any command list before the one that you removed the ResourceBarrier() from?

Resource promotion/decay is an advanced feature of D3D12 that's also known as implicit resource transitions, which is perhaps a more explanatory name. In some scenarios, certain types of resources in the COMMON state will be implicitly transitioned ("promoted") into the necessary target state upon first GPU access in a command list without the application performing an explicit ResourceBarrier() call. Certain resources can also be implicitly transitioned ("decay") back into COMMON at the end of an ExecuteCommandLists() call.

For example, a buffer whose last state in an ExecuteCommandLists() call is UNORDERED_ACCESS will decay back to COMMON at the end of the ExecuteCommandLists() call, without the app performing a ResourceBarrier() call. If the first usage of the buffer in the next ExecuteCommandLists() call is as a copy dest then the app wouldn't need to explicitly transition the resource into COPY_DEST (via ResourceBarrier()) because the resource would be implicitly promoted into that state.

The MSDN page you linked to is a good resource for more information, along with this blog post: https://devblogs.microsoft.com/directx/a-look-inside-d3d12-resource-state-barriers/

Advertisement

@austin.kinross Thank you very much for your explanation.

The Dst is indeed a buffer. I didn't use this buffer before the mentioned call. The Dst init state is Unorder Access.

Great, thank you for confirming those details. I've filed an internal PIX bug for this (for our reference: bug number 24521130).

This topic is closed to new replies.

Advertisement