Graphics Reference
In-Depth Information
the line has a slope outside of the range defined above, then
it is considered a y-major line. In this case, the same test is
performed, with the exception that the right corner is also
included in the test. These intersection images are shown in
the right side of Figure 3.62.
The final primitive type that can be rasterized is the
point primitive. Point primitive rasterization actually uses the
same rules as triangle rasterization, by conceptually expand-
ing itself into two triangles that form a 1 x 1 square around
its point position. These triangles are then rasterized exactly
as if they were triangle primitives. Several examples of this
pattern are shown in Figure 3.63.
Figure 3.63. Several exam-
ples of point rasterization as
a pair of triangles.
Scissor test. In all of these cases, the primitives must pass the scissor test, in addition to ful-
filling the rasterization rules. As we have seen in the "Rasterizer State Configuration" sec-
tion, the application can configure the scissor test by binding an array of scissor rectangles
to the rasterizer stage. The rasterizer stage then selects the appropriate scissor rectangle,
based on the same criteria used to select the viewport. If the SV_ViewportArrayIndex is
declared as one of the input attributes for the rasterizer stage, then it is used to select from
the array. Otherwise, the rasterizer defaults to the first entry. This selection mechanism en-
sures that the viewport index and scissor rectangle index are always the same, which allows
the application to trivially reference pairs of these objects together.
The scissor test works by comparing the fragment's X- and Y -components against the
scissor rectangle. If the fragment falls outside of the rectangle, it is culled and will not con-
tribute to the render target. It is also important to note that the exact location of the scissor
test in the sequence of operations of the rasterizer may vary, depending on the hardware
implementation. This may have some performance implications, due to a variable location
that fragments are culled from. However, the application can be sure that the pixels outside
of the scissor rectangle will not be written to the render target.
Attribute interpolation. After the fragments that are affected by the current primitive
are identified and have survived the scissor test, the rasterizer stage must determine what
attribute data to produce for each fragment that it generates. To calculate these attribute
values, the rasterizer interpolates each input attribute from its input primitive vertices. The
input attribute value from each primitive contributes to the interpolated fragment output
attribute value based on the distance from the pixel center. This means that the closer a
fragment is to one of the vertices in a primitive, that the vertex will have a proportionally
larger influence on the attributes generated at that location. This is depicted in Figure 3.64
with a simple example. In addition to the general attributes being interpolated, the depth
at each fragment is also interpolated and will be used later in the pipeline in the depth test.
Search WWH ::




Custom Search