1
\$\begingroup\$

I'm new to DirectX and I feel like I killed Google search but still cannot find information about the difference between these:

  • Immediate context + Command Lists
  • Immediate context + Deferred context (Command List)

As I understood from D3d docs, Deferred context is the same as Immediate, but it records all its API calls to the internal Command List. And then I should execute that list using an immediate context to apply all the commands to the GPU.

But from another side, in d3d docs, I found that a Command List can be created without a deferred context. Also on that page I found that the list has a huge amount of API methods like DrawInstanced, DrawIndexedInstanced, etc.

And, I wondered when I found this article, whether all those API methods can be actually used directly. I wondered because from D3D docs it sounds quite the opposite:

A command list must be recorded by a deferred context

I'm stuck on this. Right now, for me, it sounds like I can solve 1 task using 2 identical ways:

  1. Create a Command List, call commands on it (still don't understand is it valid to do so or not), and execute on an immediate context later to defer GPU calls.
  2. Create a Deferred Context, call commands on it, and execute its internal list on an immediate context later.

So my question is, do those 2 items from the list produce the same result?

And if yes, then what is a Deferred Context then? What does it do that the Command List cannot?

Just now I cannot find the difference, but I'm sure that there is one.

\$\endgroup\$

1 Answer 1

1
\$\begingroup\$

There are a few things different, I will try to be concise.

Deferred Contexts allow you to run your command set up in separate threads as if you are calling immediate context. The commands are then queued against the deferred context, you can have a different Deferred Context per thread but you must execute the deferred command list from each thread in the main thread where you created your device and immediate context. The command lists are not pushed to the immediate context until you execute the command list, and they can be pushed in any order you desire.

What benefit does it give you? There are some optimisations that occur. On slower CPUs where you are command throughput limited it gives you some improvement in framerate if you are constrained. As long as the CPU is multicore, you may see some benefit in this scenario.

With immediate mode, each command or shader binding you do occurs in real time, that is it is pushed to your GPU pipeline and applied. As per above, this must be run in your main thread where your immediate and device contexts were created.

There is a link also to other constraints of Deferred, you can find them on this page put more succinctly than myself.

Deferred vs Immediate

\$\endgroup\$
1
  • \$\begingroup\$ Thanks for your reply. Yeah, your answer is quite useful. After some research I think I figured this out: Direct 11 - Has Immediate context, Deferred context (Command lists) Direct 12 - NO more immediate contexts, only Command lists Regarding to this link Direct3D 12 introduces a new model for work submission based on command lists that contain the entirety of information needed to execute a particular workload on the GPU. \$\endgroup\$ Feb 13, 2023 at 15:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .