Graphics Reference
In-Depth Information
data into memory, and could then allow the main rendering thread to use the data and create
the API resource. This technique provides some relief from the delays described above, but
unfortunately, it is not available or applicable in all situations. For example, when creating
shader objects out of the compiled byte code, multiple threads are not helpful, since the
device is only accessible from one thread.
In older Direct3D editions, the general use of multiple threads for resource creation
is limited to trying to find ways around the limitations imposed by the fact that the API was
not designed for use in a multithreaded environment. This adds complexity to the overall
application structure, and it requires additional development time to ensure that all of the
interactions between secondary threads and the rendering thread are properly implemented.
7.2.2 Draw Submission Sequences
The second area of rendering that can benefit from multiple threads of execution is draw
submission sequences. These consist of all interactions that the application has with the
pipeline, including all pipeline state settings, and
any pipeline executions done with draw calls or
dispatch calls. Once an application moves out
of the startup phase and into the normal execution
mode, this is the primary work that gets performed
to render a frame. This type of work is depicted in
Figure 7.1, with several state changes followed by
draw calls.
As you can see in Figure 7.1, the stream of API
calls are grouped together to render one object after
another, with each object identified by a different
color. You can also see that all of these API calls are
performed in a sequential manner, because render-
ing operations are traditionally restricted to a single
thread. Due to the high number of these API calls
that are commonly used to render a single frame, the
CPU may become a bottleneck to the application's
overall performance. A large portion of the driver
model changes made between D3D9 and D3D10
were intended to reduce the amount of overhead for
each of these API calls, and hence, to increase the
maximum number of calls programmers could make
for a given frame while still achieving a target frame
rate. In fact, many optimization techniques for the
Figure 7.1 . A series of API calls required
to perform a rendering operation.
Search WWH ::




Custom Search