Sign in to follow this  
nbertoa

[D3D12] ID3D12CommandQueue::ExecuteCommandLists() execution order

Recommended Posts

Hi community

 

Does ID3D12CommandQueue::ExecuteCommandLists() guarantee command lists will be executed in order?

 

For example:

ID3D12CommandList* ppCommandLists[] = { cmdList0, cmdList1, cmdList2, cmdList3 };
m_commandQueue->ExecuteCommandLists(_countof(ppCommandLists), ppCommandLists);

cmdListN will be executed before cmdListM where N < M? MSDN documentation does not mention anything about that, so I do not know if that is undefined / GPU/driver dependant / etc.

 

Share this post


Link to post
Share on other sites

All of the work submitted in a single call to ExecuteCommandLists is guaranteed to complete before the next batch of work submitted in a subsequent call, but within a single "execution group," the driver may be able to re-order commands, or maintain pipelining, as if it was a single command list.

Does this mean that submitting command lists with dependencies between each other, in a single batch, is not reliable?

Share this post


Link to post
Share on other sites

IIRC to ensure coherency between draw calls within a single executecommandlists batch you use resource barriers.  They will flush caches and prevent pipelining and whatever is necessary to ensure coherency.

 

edit - here watch this: https://www.youtube.com/watch?v=Db2TaG49SRg

Edited by Infinisearch

Share this post


Link to post
Share on other sites

I just did a quick test. I executed 4 command lists in a single ID3D12CommandQueue::ExecuteCommandLists() and it worked properly over multiple frames.

cmdList1 = CD3DX12_RESOURCE_BARRIER::Transition(resource, D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE, D3D12_RESOURCE_STATE_RENDER_TARGET),

cmdList2 = CD3DX12_RESOURCE_BARRIER::Transition(resource, D3D12_RESOURCE_STATE_RENDER_TARGET, D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE),

cmdList3 = CD3DX12_RESOURCE_BARRIER::Transition(resource, D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE, D3D12_RESOURCE_STATE_RENDER_TARGET),

cmdList4 = CD3DX12_RESOURCE_BARRIER::Transition(resource, D3D12_RESOURCE_STATE_RENDER_TARGET, D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE),

ID3D12CommandList* cmdLists = { cmdList1, cmdList2, cmdList3, cmdList4 };
cmdQueue.ExecuteCommandLists(__countof(cmdLists), cmdLists);

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this