# DX12 error using resource barrier from multiple commandlists for same resource

This topic is 1127 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

In dx12 we have to manage resource before/after state ourselves, but all the dx12 docs sample code uses the same commandlist to call resourcebarrier. in my program, I use a computeCommandList to update a volume buffer and then use graphicCommandList to visualize the volume every frame. So for the volume buffer resource state I have the following state change flow:

void CreateResource(...){
...
m_graphicCmdList->ResourceBarrier( 1, &CD3DX12_RESOURCE_BARRIER::Transition( m_volumeBuffer.Get(),
D3D12_RESOURCE_STATE_COPY_DEST,
VRET( m_graphicCmdList->Close() );
ID3D12CommandList* ppCommandLists[] = { m_graphicCmdList.Get() };
m_graphicCmdQueue->ExecuteCommandLists( _countof( ppCommandLists), ppCommandLists);
...
}
void Update(...){
...
!! m_computeCmdList->ResourceBarrier( 1, &CD3DX12_RESOURCE_BARRIER::Transition( m_volumeBuffer.Get(),
D3D12_RESOURCE_STATE_UNORDERED_ACCESS ) );
...
m_computeCmdList->Dispatch(...);
...
m_computeCmdList->ResourceBarrier( 1, &CD3DX12_RESOURCE_BARRIER::Transition( m_volumeBuffer.Get(),
D3D12_RESOURCE_STATE_UNORDERED_ACCESS,
...
}



However I got error msg @ !! line:
D3D12 ERROR: ID3D12CommandList::ResourceBarrier: D3D12_RESOURCE_STATES has invalid flags for compute command list. [ RESOURCE_MANIPULATION ERROR #537: RESOURCE_BARRIER_INVALID_COMMAND_LIST_TYPE]

Any idea? Thanks

##### Share on other sites
As I understand it, the different command list types (graphics/direct, compute, and copy) can only deal with resource states that they can understand. So In order to transition to or from a pixel shader resource, you need to use a graphics command list. So you'll need to transition to and from the UAV state on your graphics command list, rather than on your compute command list.

##### Share on other sites

As I understand it, the different command list types (graphics/direct, compute, and copy) can only deal with resource states that they can understand. So In order to transition to or from a pixel shader resource, you need to use a graphics command list. So you'll need to transition to and from the UAV state on your graphics command list, rather than on your compute command list.

Thanks, but the dx12 doc doesn't mention anything that different command list types have this kind of restrictions.... sign....

However it did mention that

"The debug layer normally issues errors where runtime validation fails:

• If a subresource transition in a command list is inconsistent with previous transitions in the same command list.

"

So I guess maybe in my case from m_compoutCmdList point of view, the first call to ResourceBarrier have before state not matching the previous transition in this commandlist (since the initial resource state set is in m_graphicsCommandLIst)?

And if that is the case, it will be a headache to sync resource state for multiple commandlist if we want to use multiple commandlist to call resourcebarrier?

1. 1
2. 2
3. 3
Rutin
15
4. 4
khawk
14
5. 5
frob
12

• 9
• 11
• 11
• 23
• 12
• ### Forum Statistics

• Total Topics
633661
• Total Posts
3013221
×