12.3 RS - Rasterizer

The Rasterizer's main job is implied in its name: to generate pixels that cover the interior of the primitive. The primitives are either triangles or rectangles. For each pixel, the RS generates the following attributes:

  1. screen x,y location

  2. z depth for Z buffer purposes

  3. RGBA color information

  4. s/w, t/w, 1/w, LOD for texture index, perspective correction, and mipmapping. These are commonly referred to as s, t, w, l.

  5. coverage value (Pixels on the edge of primitives have partial coverage values. Interiors are full.)

These values are sent to the pipelined blocks downstream for other computations, such as texture sampling, color blending, and so on.

Figure 12-3 RS State and Input/Output
[Figure 12-3]


12.3.1 Scissoring

Scissoring is commonly used to eliminate running performance-intensive clipping code in the geometry processing stage of a graphics pipeline. You do this by projecting the clipping rectangle at the near plane larger than the scissor rectangle. The rasterizer can then efficiently eliminate the portion outside of the screen rectangle.

The RSP geometry processing is performed in fixed-point arithmetic. The clipped rectangle boundary is not a perfect rectangle, because of precision errors. This artifact can also be eliminated using the scissoring rectangle.

Figure 12-4 Scissor/Clipping/Screen Rectangles
[Figure 12-4]

Triangle A is scissored, but not clipped. B, C and E are trivially rejected because no pixels are enumerated. Only D is clipped and scissored.

Table 12-9 gsDPSetScissor(ulx,uly,lrx,lry)
ulxupper left x
ulyupper left y
lrxlower right x
lrylower right y

Note: Rectangles are scissored with some restrictions. In 1CYCLE and 2CYCLE mode, rectangles are scissored the same as triangles. In FILL and COPY mode, rectangles are scissored to the nearest four pixel boundary; this might require rectangles to be scissored in screen space by the game software.