Graphics Reference
In-Depth Information
Figure 3.72. A pixel shader be-
Figure 3.73. Many pixel shader invocations being executed
ing executed to produce a single
simultaneously.
fragment output.
with the pixel shader. The concept of a single fragment being processed for each pixel
shader invocation is depicted in Figure 3.72.
By following this model and restricting communication between threads, many dif-
ferent invocations of the pixel shader can be calculated simultaneously in parallel process-
ing elements. Since each invocation receives its own data from its input fragment, and
writes its own output to the location specified by the fragment, it does not rely on neighbor-
ing invocations. A schematic concept of this is shown in Figure 3.73.
At a lower hardware level, this is still mostly true, with the exception that pixel
shader invocations are always performed in at least 2x2 groups of fragments. This is done
to ensure that screen space derivative instructions can be calculated across the invocations
in both the X- and Y -directions by performing a discrete difference. The calculation of
these derivative instructions relies on the fact that multiple invocations are running at the
same time, and if a variable is passed into one of the derivative instructions, then the GPU
will use the difference of the neighboring invocations' variables to find how that variable's
value is changing over screen space. In practice, this behavior is transparent to the applica-
tion, and the boundary between pixel shader invocations remains.
Multiple render targets. We have already mentioned that the pixel shader calculates and
outputs a color to pass to the output merger stage. However, this is not restricted to a single
color. We will see in the output merger stage section that it is possible to bind up to eight
Search WWH ::




Custom Search