Graphics Reference
In-Depth Information
11. The following screenshot shows an example by running at a frame time of 8.2 ms
with seven deferred contexts and threads. By comparison, rendering only on the
immediate context on the same hardware configuration results in a frame time
of 24.8 ms.
Multithreaded rendering benchmark application running with 100 meshes, seven threads and deferred context
instances, and an additional 3,000 matrix multiplications performed per mesh.
How it works…
A deferred context allows for a sequence of commands and state changes to be recorded and
then packaged up into a command buffer for later execution on the Direct3D device's immediate
context. We have implemented a method of creating a number of deferred contexts, starting
with a new thread for each context and then splitting the load of rendering meshes across them.
Our renderers are then able to use the deferred context to submit Direct3D commands by using
the provided context instead of retrieving the device.ImmediateContext property directly.
We implement this by calling the Render(DeviceContext context) function to support
circumstances where the same instance of the renderer needs to be rendered multiple times in
different threads. Before playing back the command lists on the immediate context, we first wait
for all the threads to complete.
 
Search WWH ::




Custom Search