• Advertisement
Sign in to follow this  

Deferred contexts and inheriting state from the immediate context

This topic is 1914 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I took my first stab at using deferred contexts in DirectX 11 the other day. My use-case for deferred contexts is probably somewhat different from the common scenario though; I'm interested in rendering a bunch of things on a deferred context, have them executed on the immediate context and then have the API reset the immediate context to what it was before I executed my commands (i.e. basically restoring the render state).

To test this, I created my deferred context using CreateDeferredContext() and then rendered 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 when I executed the generated command list on the immediate context.

That didn't seem to be the case, however. Instead, I had to manually pull out the immediate context's render target view (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 this post


Link to post
Share on other sites
Advertisement
ID3D11DeviceContext::FinishCommandList: http://msdn.microsoft.com/en-us/library/windows/desktop/ff476424%28v=vs.85%29.aspx

Immediate context state is cleared before and after a command list is executed. A command list has no concept of inheritance.[/quote]

Share this post


Link to post
Share on other sites
Haha, I've been reading the docs up and down -- even sideways -- and I still missed this. I'm glad somebody else knows how to read. tongue.png I guess what threw me off is that the paragraph you linked is missing from ExecuteCommandList(), which is where it's most relevant, in my opinion.

Share this post


Link to post
Share on other sites

Haha, I've been reading the docs up and down -- even sideways -- and I still missed this. I'm glad somebody else knows how to read. tongue.png I guess what threw me off is that the paragraph you linked is missing from ExecuteCommandList(), which is where it's most relevant, in my opinion.


A fault with the documentation is that info like this does tend to be scattered around, sometimes in the oddest places, yes.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement