Graphics Reference
In-Depth Information
a frame across multiple CPU cores when they are available. When used properly, these
designs can provide flexibility and the ability for your program's performance to scale with
an increasing number of CPU cores in a user's system. This is referred to as the scalability
of the software, and it will become increasingly more important as the average number of
CPU cores continues to increase.
This chapter introduces and discusses the tools that have been added to the Direct3D 11
API to facilitate multithreaded rendering operations. This is distinct from, and should not
be confused with, general multithreaded computation. 1 Here, we are concerned with using
multiple threads of execution to render a frame as quickly as possible, without considering
the other processing tasks that need to be performed within the application. However, if the
time required to perform a frame's rendering requests is minimized by the use of multiple
threads, the overall performance of the application improves, leaving more processing time
for other tasks. These new Direct3D 11 tools allow the developer to use multiple threads
for two types of operations—resource creation, and draw submission sequences. These are
the two primary tasks that any Direct3D 11 application performs, creating the objects it
needs, and then using them to feed the GPU with work to keep it busy. Efficiently perform-
ing these two key tasks lets a program use multithreaded code for the majority of the inter-
actions with the D3D11 API, allowing its performance to scale with additional CPU cores.
7.2 Motivations for Multithreaded Rendering
Before we dive into the details of the Direct3D 11 threading model, it is important to under-
stand what we want to be able to achieve with by introducing multithreading to rendering-
related operations. After all, if there is no benefit, why should we introduce the complexity
of multithreading into our rendering code? The truth is that there are very tangible reasons
to want to break the rendering code path out of serial execution. The areas that we will
focus on in this section are resource creation andpipeline manipulation.
During these discussions, it is useful to understand how other recent iterations of
Direct3D were used. In both D3D9 and D3D10, it was possible to create a device with
a multithreaded flag that would make the methods of the rendering device thread-safe.
However, this thread-safe property was achieved by using coarse synchronization primi-
tives to effectively serialize access to the code within the methods. Therefore, if two threads
simultaneously called the same device method, one thread would have to wait until the
other method invocation was completed. This hinders any performance gains from using
1
Many resources are available to begin exploring this vast topic. The reader is encouraged to view the fol-
lowing threading library resources as a place to start (Microsoft Corporation) (OpenMP Architecture Review
Board).
Search WWH ::




Custom Search