Jump to content
  • Advertisement
Sign in to follow this  
Mr_Fox

DX12 error using resource barrier from multiple commandlists for same resource

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

If you intended to correct an error in the post then please contact us.

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(...){
   ...
   UpdateSubresources( m_graphicCmdList.Get(), m_volumeBuffer.Get(), volumeBufferUploadHeap.Get(), 0, 0, 1, &volumeBufferData );
   m_graphicCmdList->ResourceBarrier( 1, &CD3DX12_RESOURCE_BARRIER::Transition( m_volumeBuffer.Get(),
                                                                                  D3D12_RESOURCE_STATE_COPY_DEST,
                                                                                  D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE ) );
   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_PIXEL_SHADER_RESOURCE,
                                                                                  D3D12_RESOURCE_STATE_UNORDERED_ACCESS ) );
   ...  
   m_computeCmdList->Dispatch(...);
   ...
   m_computeCmdList->ResourceBarrier( 1, &CD3DX12_RESOURCE_BARRIER::Transition( m_volumeBuffer.Get(),
                                                                                  D3D12_RESOURCE_STATE_UNORDERED_ACCESS,
                                                                                  D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE) );
   ...
}

 
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 this post


Link to post
Share on other sites
Advertisement
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 this post


Link to post
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?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!