Graphics Reference
In-Depth Information
overall execution to continue without pipeline stalls. For example, consider if we have one
command list that generates a shadow map, another one that updates a simulation with the
compute shader, and a third one that performs the final scene rendering. If the simulation
contains two buffer resources for containing its state, then we can render the current frame
with the current buffer and use the GPU resources to update the buffer for the next frame.
With this set of command lists, we can execute them in the following order: the shadow
map first, then the simulation, and finally, the perspective rendering. The reason behind this
is depicted in Figure 7.10.
When the command lists are submitted in this order, execution of the final rendering
pass doesn't start until the shadow map has already been completed. This means that the
GPU will remain busy the entire time, without waiting for one pass to complete before
continuing with the final pass.
Switching Modes
Another general piece of advice regarding the ordering of command lists is to minimize the
number of times an application switches between using the GPU for rendering and using it
for computation. If a full-frame rendering consists of several computation workloads (i.e.
using Dispatch calls) as well as several rendering workloads (such as using Draw calls)
then they should be ordered such that the computation command lists are executed together
(as much as possible) to minimize how many times the GPU switches modes. This is gen-
eral advice based on current GPU implementations, which may or may not continue to be
the case in future generations of hardware.
Context State Assumptions
If you are porting an existing rendering system to Direct3D 11, it is quite possible that
your previous rendering system makes some optimizations about setting pipeline states to
eliminate redundant state changes and minimize the number of API calls in every frame. A
typical example is to keep a reference to the current render target, and ensuring that when
your application tries to set a render target, it checks to see if the current target already
matches the desired one.
In previous versions of Direct3D, this would reduce the number of API calls and
relieve the application code from having to manage the state itself. However, due to the
way that context state is implemented in Direct3D 11, there are significant differences to
how any such state-caching system will need to operate. These systems can still be used,
but they must be aware that the complete pipeline state may or may not be reset based on
the calls to FinishCommandList and ExecuteCommandList, as detailed above. State cach-
ing can still reduce unnecessary API calls within a command list generation pass, but the
caching system needs to be reset at the appropriate points, depending on how the command
lists are generated and executed.
\
Search WWH ::




Custom Search