Graphics Reference
In-Depth Information
This new ability to write to any location of a resource can be used to extract addi-
tional information from the rendering process. For example, the generation of a histogram
can be performed simultaneously with the rendering of the scene. A histogram provides
a number of bins, where each bin represents the number of pixels that have a value that
resides within a particular range. A histogram provides an indication of the distribution of
the values in an image. By examining the output color of a pixel shader, the histogram bin
that the color falls into can be determined. Then, a resource can be accessed using a UAV,
and the appropriate bin value can be incremented. This would not have been possible prior
to the introduction of UAVs.
Even more complex rendering algorithms can be implemented with the use of UAVs.
Since read and write access to resource is available, generic data structures can be imple-
mented using UAVs. This ability has been used to build linked list implementations out of
GPU resources, which can then be used as building blocks for other algorithms.
Multisample Anti-Aliasing Considerations
Since the pixel shader operates very close to the final rendered image, several special pixel
shader functionalities should be considered when using MSAA. With non-MSAA ren-
dering, the coverage test performed for each pixel's sample point determines if the pixel
shader stage should be executed for that pixel. With normal MSAA rendering, the pixel
shader is still only executed once per pixel. Thus, the pixel shader will be executed as long
as at least one of the sample points passes the coverage test. After the shader is executed,
the value(s) output by the shader are written to the corresponding subsamples in the cur-
rently bound render target(s).
Sampling MSAA textures in shatters. In Direct3D 11, shader resource views can be created
for MSAA textures, so that the textures can be bound as inputs to the various shader stages.
This is done by setting D3D11_SRV_DIMENSI0N_TEXTURE2DMS as the ViewDimension mem-
ber of the D3D11_SHADER_RES0URCE_VIEW_DESC structure passed to the ID3D11Device
: :CreateShaderResourceView method. However, when the view is bound to the pipeline
for a stage, that stage cannot sample the texture using the normal Texture2D object and
its various methods. Instead, a Texture2DMS object must be declared. This object sup-
ports the load method, which allows you to specify both XY position and the index of
the subsample that you want to retrieve. It also supports the GetDimension method for
querying the XY dimensions and the number of subsamples in the texture, as well as the
GetSamplePosition method for querying the pixel coverage sample point used for a spec-
ified subsample index. Using these methods in a pixel shader allows for custom resolve
algorithms to be implemented, rather than relying on what the hardware provides.
Alpha-to-coverage. Alpha -to -coverage is a technique that modifies how a pixel shader's
output is written to the rendertarget. When enabled by setting the AlphaToCoverageEnabled
Search WWH ::




Custom Search