Skip to main content

quantize_x

Function quantize_x 

Source
pub const fn quantize_x(x: i32) -> i32
Expand description

Quantize a signed edge X to the 3-fraction-bit sub-pixel domain used by compute_coverage, with the RDP sticky bit.

Any discarded fraction bit forces the low output bit set, so a truncated-but-nonzero coordinate never snaps exactly onto a sub-pixel boundary — this is what makes the half-open < / >= edge tests in compute_coverage bit-exact (parallel-rdp span_setup.comp:60-66).

Fixed-point domain. parallel-rdp’s setup.xh is s.15 (its base_x = xh >> 15), so it quantizes with >> 12 to reach the s.3 coverage domain. Our edge values are the raw command s.16 (major >> 16 is the pixel), one fraction bit wider, so we shift >> 13 and take the sticky bit over the low 13 discarded bits — the same 3-fraction-bit result.

This and compute_coverage are the sub-pixel coverage primitives (T-33-004 slice 2c); the rasterizer’s edge-walk still unions the four sub-scanlines into a whole-pixel bounding span (open residual R-9) until the coverage integration lands, so these have no runtime caller yet.