OMSetRenderTargets per Command List?

Started by
5 comments, last by Mercesa 6 years, 10 months ago

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?

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.

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...

According to the documentation (link below), yes it is a necessity. There is some inheritance for bundles, but between direct command lists the pipeline state is reset.

https://msdn.microsoft.com/en-us/library/windows/desktop/dn899196(v=vs.85).aspx#Graphics_pipeline_state_inheritance

I guess that's as clear cut as it gets. Thanks!

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.

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.

This topic is closed to new replies.

Advertisement