I have only found the documents on MSDN: http://msdn.microsoft.com/en-us/library/windows/desktop/ff476884(v=vs.85).aspx Although it doesn't say anything about creating them, it mentions that device is thread-safe while device context is not.

Does the framework use threads by itself (if driver supports it) when it thinks it's more optimal? Or do we have to use some external library like BOOST to play around with threads?


1 Answer 1


You have to create the threads yourself, using your threading library of choice (boost, C++11 async, Windows threads, etc). The idea is that you will create several threads and split up your CPU rendering work amongst them. Each thread uses a D3D11 deferred context to accumulate all the D3D11 commands (state changes, draw calls, etc.) it wants to execute. Later, in your main thread, you'll use the immediate context to call each deferred context, to send those command buffers to the GPU to be rendered. The main thread should also do the Present() call to display the final frame on-screen.

There's a little more detail in the blog post Direct3D 11 Multithreading by Rory Driscoll:

The basic idea behind multithreading in Direct3D 11 is that you create an immediate device context on the main thread. Then, for each thread on which you’d like to be able to render, you create a deferred context. As you can probably guess from the names, commands executed on the immediate context get executed immediately, but those on the deferred context just get saved off into a command list. You then execute the deferred command lists on the main thread using the immediate device context.

Note that the D3D11 driver may also create threads internally for its own purposes, but this is under-the-hood and has nothing to do with "multithreaded rendering" per se.


You must log in to answer this question.

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