• Advertisement
Sign in to follow this  

OMSetRenderTargets per Command List?

Recommended Posts

Let's say I have three command lists, A B and C.  They are guaranteed to be submitted in order.  If I call OMSetRenderTargets on list A, can I then ignore calling it on the B and C lists and assume they will be writing to the same render target?

Share this post


Link to post
Share on other sites
Advertisement
Each separate command list should be seen as having it's own completely separate state and setup. You should call it from each individually. You'll also need to set your description heaps, etc., (even if they're the same) on each.

Share this post


Link to post
Share on other sites

Is it a necessity per list though?  Wouldn't putting in a fence to ensure the correct setup has been processed be less work for the GPU than calling OMSetRenderTargets, RSSetViewports, and RSSetScissorRects for every list?  To clarify, I'm making those calls per list now, but I'm just wondering if there's a better way to do it...

Share this post


Link to post
Share on other sites

GPUs aren't necessarily as stateful as your mental model might indicate. Each command list command isn't necessarily something that's executed by the GPU. It might simply be storing some CPU-side state which will be used by the driver when recording a subsequent command. In that case, since command lists can be recorded in parallel and submitted out-of-order, these types of commands need to be present in every command list.

Rather than try to pin hardware to a particular model where some states must be set by hardware commands, and others may be CPU-side tracking, D3D12 requires all command list state to fit into a model that supports either.

Share this post


Link to post
Share on other sites

I recommend splitting command lists into multiple render passes or generic object passes to reduce state overhead. And maybe if you feel that the command lists are too small and should be combined, then probably they should be just one command list. 

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  

  • Advertisement