Skip to main content

alpha_column

Function alpha_column 

Source
pub const fn alpha_column(alpha_idx: u32) -> u32
Expand description

The alpha column the strip shader addresses coverage by, from the byte index a Strip carries.

The two are different units, and the conversion is the shader’s own. A strip’s alpha_idx counts coverage bytes from the start of the frame’s buffer; GpuStrip::col_idx_or_rect_frac is read as a column ordinal, which the fragment stage turns into a texel with col / 4 and a channel within it with col % 4 — one channel holding one pixel column’s Tile::HEIGHT coverage bytes. So a column is Tile::HEIGHT bytes wide, which is the same unit Strip::width_to already reports a strip’s width in.

Getting this wrong is invisible on fully-covered geometry and total on anti-aliased geometry: every alpha-sampled span reads past its own coverage, lands on unwritten texels, and resolves to zero alpha.