Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I took my first stab at using deferred contexts in DirectX 11 today. Basically, I created my deferred context using CreateDeferredContext() and then drew a simple triangle strip with it.

Early on in my test application, I call OMSetRenderTargets() on the immediate context in order to render to the swap chain's back buffer. Now, after having read the documentation on MSDN about deferred contexts, I assumed that calling ExecuteCommandList() on the immediate context would execute all of the deferred commands as "an extension" to the commands that had already been executed on the immediate context, i.e. the triangle strip I rendered in the deferred context would be rendered to the swap chain's back buffer.

That didn't seem to be the case, however. Instead, I had to manually pull out the immediate context's render target (using OMGetRenderTargets()) and then set it on the deferred context with OMSetRenderTargets().

Am I doing something wrong or is that the way deferred contexts work?

share|improve this question
up vote 1 down vote accepted

Turns out the answer was staring me in the face on MSDN:

Immediate context state is cleared before and after a command list is executed. A command list has no concept of inheritance. Each call to FinishCommandList will record only the state set since any previous call to FinishCommandList.

I don't know why it's mentioned on the page for ID3D11DeviceContext::FinishCommandList when it's even more relevant for ID3D11DeviceContext::ExecuteCommandList.

share|improve this answer

I think a good solution would be to record the state of the immediate context after the initialization code and then execute the list on each deferred context when you create it and then call FinishCommandList on the deferred contexts just to prevent the initialization operations from being merged into the actual command lists later on. But I'm not sure if that's what they intended.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.