Graphics Reference
In-Depth Information
interpolated and passed along with each fragment for use in the depth test of the output
merger stage.
The position of the fragment may or may not be added into the generated fragments.
This depends on whether the pixel shader input signature declares one of its input attri-
butes to have the SV_Position system value semantic. Prior to the rasterizer stage, the
SV_Position value was used to indicate a version of the vertex position. When passed
into the rasterizer, it must contain the clip space vertex location. However, the fragment
location is provided in the output of the rasterizer. This can be used in the pixel shader to
look up values in other texture resources, or for performing processing based on the screen
location, such as fading the render target color to black at the outer edges of the screen.
3.11 Pixel Shader
After a primitive is converted into fragments by the rasterizer, the fragments are passed to
the pixel shader stage. The pixel shader stage is the final programmable shader stage in
the rendering pipeline. It processes each fragment individually by invoking its pixel shader
program. Each pixel shader invocation operates in isolation—no direct communication
is possible between individual fragments being processed. 33,3 4
After the pixel shader has
completed, the result is a processed output fragment, which is passed to the output merger
stage. The location of the pixel shader within the pipeline is highlighted in Figure 3.67.
The pixel shader stage is responsible for the primary appearance of a rendered primi-
tive. Prior to rasterization, processing was primarily focused on manipulating the number
of primitives, their size, shape, and attributes. These are all geometric-style operations.
During rasterization, these primitives are used to select which pixels are affected by them,
and fragments are generated accordingly. The pixel shader can only receive the fragments
that are passed to it—it is not possible to change the location of a fragment from within the
Figure 3.67. The pixel shader stage.
3 3
The derivative instructions used data shared between multiple fragments.
3 4
Unordered access views change this strict isolation, but there is still a fairly strong communication separation
between pixel shader invocations.
Search WWH ::




Custom Search