Graphics Reference
In-Depth Information
The application may bind from 1 to 8 total render targets simultaneously for generating
multiple versions of the same rasterized scene. These render targets must match in type
(such as Texture2D, Texture2DArray, etc..) and size (including width, height, depth, ar-
ray size, and sample counts), but may have different formats from one another. When
more than one render target is bound, it is referred to as a multiple render target (MRT)
configuration.
This arrangement also uses a single depth stencil target, even though there are mul-
tiple render targets in use. Since the depth stencil target is used to carry out the depth and
stencil tests, it must be the same type and size as the resources bound as render targets, but
its format will be one of the depth stencil formats. As indicated above, these size-matching
requirements hold true for MSAA render targets as well. If an MSAA render target is
bound for output, then the depth stencil target must also be an MSAA resource with the
same number of subsamples. In addition, the array size of a resource must match between
the render and depth stencil targets. You may recall from Chapter 2 that a resource can be
created as an array resource, where a number of texture slices are created within the same
resource. If a render target has six array slices to produce a cube-map, then the depth stencil
target must also have six array slices.
One final configuration is also possible that doesn't use a render target at all. It is pos-
sible to bind only a depth stencil view to the pipeline. In this case, each render target slot is
emptied by binding a NULL value to it, while the depth stencil view is bound as it is in a
regular rendering configuration. This is commonly used to fill the depth stencil target with
the depth information of the scene before proceeding with additional rendering passes.
MRT vs. render target arrays. A distinction should be noted between how MRTs and
render target arrays differ. It is possible to create eight individual texture resources and
then bind them to the output merger stage for use in an MRT configuration. It is also pos-
sible to create a single texture array resource that has eight texture slices and then bind that
resource to the output merger for use in a single render target configuration. Even though
they would provide the same number of effective render targets, there are several differ-
ences in the mechanics of using these configurations and in their capabilities. An MRT
configuration uses more than one render target slot—one for each render target to be used.
On the other hand, an array-based resource only occupies a single render target slot in the
output merger. This produces another difference between the two configurations—MRT
setups write to all of their render targets simultaneously, while array-based setups only
write to one slice at a time. Since the pixel shader can write to all MRT render targets si-
multaneously, only a single pixel shader invocation is needed to write to all targets. Since
the pixel shader can only write to a single render target in the array-based configurations, it
would take one pixel shader invocation to write to each of its texture slices.
This situation seems to indicate that MRT configurations are a better choice, since
this can reduce the number of pixel shader invocations, while still writing to the same
Search WWH ::




Custom Search