Expand description
The Config uniform every strip shader binds.
Named GpuConfig rather than Config because the crate root already
owns a config module of process-wide kill switches (crate::config);
this one is the GPU-side uniform buffer’s layout and nothing else.
Field order and size are part of the shader contract — see the module
header of super.
§The width shifts are the source of truth
The strip program addresses its resource textures by shift and mask alone:
a flat texel index i in a texture 1 << bits wide is the texel
(i & ((1 << bits) - 1), i >> bits). It never asks a texture for its own
width (textureDimensions per fragment was measurably not free on a mobile
GPU), so the two shifts here are the only statement of those widths the GPU
sees, and three textures depend on them:
- the alpha texture, by
GpuConfig::alphas_tex_width_bits; - the encoded-paint texture, by
GpuConfig::encoded_paints_tex_width_bits; - the gradient LUT, by the same
encoded_paints_tex_width_bits— the uniform has no field of its own for it, and needs none, because the renderer sizes every resource textureresource_texture_dimwide.
resource_widths_agree is that rule as a check: a debug_assert! at the
one site that builds the surface config from the resource textures
(renderer’s config upload); the pooled-page configs are built from the
same dim in the same frame and are not re-checked, and a release build
checks nothing. The one pass with a narrower stand-in — the
glyph-atlas replay, whose encoded-paint texture is a one-texel placeholder —
draws solid instances only, which read neither the paint texture nor the
LUT, so its config’s paint shift addresses nothing.
Structs§
- GpuConfig
- The uniform block the strip shaders read once per draw.
Functions§
- resource_
widths_ agree - Whether a frame’s three strip resource textures are exactly as wide as
the config built for
dimsays — the precondition of the strip program’s shift-and-mask addressing (see the module doc). - tex_
width_ bits log2of a resource texture’s width in texels.