Graphics Reference
In-Depth Information
As previously mentioned, these blending operations can be performed separately for
color values and alpha values. Once the blending operation has completed, a complete
four-component RGBA color is available for writing. The final step in the blending process
is to use the render target write mask to determine which channels of the output color will
actually be written. This is specified in the RenderTargetWriteMask member of the blend
state structure. The RGBA channels correspond to the bit positions 0, 1,2, and 3 of the
mask. When the bit is set, the channel is written to the render target.
3.12.4 Output Merger Pipeline Output
We have seen throughout this section what operations are performed on the pipeline data
before it is written to the resources bound to the output merger stage. There are a total of
three different types of resources that can be written to by a pipeline execution: render
targets, unordered access views, and the depth stencil target.
The render targets receive the output from the blending functions. Each fragment
written to a render target must have survived both the stencil test and the depth test before
being blended and finally written to a render target. If MRTs are being used, then each
render target will have a blended value written to it that originates from the pixel shader.
If render target arrays are used, then the appropriate render target slice is determined back
at the input to the rasterizer stage with the SV_RenderTargetArrayIndex system value
semantic. Thus, by the time the data reaches the output of the blending function, the ap-
propriate texture slice has already been selected.
In contrast, data written to a UAV is directly controlled by the pixel shader stage and
does not need to pass any tests to successfully make it to the output resource. When the
pixel shader modifies a resource, those changes are immediately submitted to the GPU
and take effect as soon as the GPU's memory system writes the values to memory. There
is some delay in this writing process, and hence, its results must not be assumed to be im-
mediately available when designing an algorithm.
The depth stencil target is somewhat more complex. Output data must pass the depth
test and the stencil test to be written to the depth portion of the output resource. In addition,
depth writing must be enabled in the depth state object. Stencil data can be updated differ-
ently, depending on which combination of the depth and stencil tests pass. Since these are
configurable settings, it is more or less up to the application to determine when and how the
stencil data is updated by the data stream coming into the output merger stage.
After completion of the pipeline execution, the modified contents of each of these
resources are available for use in further rendering passes and computation passes, or even
for direct manipulation by the CPU. In the case of MSAA rendering, one further step is
needed before using the resource. After the rendering is finished, it is typically desirable
to resolve the MSAA render target to a non-MSAA texture. In Direct3D 11 this is done
Search WWH ::




Custom Search