Expand description
The CPU pass every scene passes before the GPU sees it.
The render service draws every app of a room on one device. A scene that
makes vello’s CPU stages panic takes the room’s rendering down; one that
makes its shaders read the wrong data draws another app’s pixels or hangs
the GPU for everyone. So a decoded Encoding is checked against exactly
the invariants vello’s own encoder establishes and its resolver and
shaders rely on:
- Streams agree with each other. Every path tag is a tag vello writes; the path data holds exactly the points the segment tags consume; there is one transform per transform tag, one style per style tag, one draw object per path (glyph runs bring their paths at resolve), and the draw data holds exactly what the draw tags say.
- Every late-bound resource is where its draw is. A gradient’s ramp and an image’s atlas slot are written by the resolver at the offset its patch names, so every gradient and image draw has exactly one patch at its own offset, in stream order, and an image draw’s size is the registered image’s: a scene cannot point the shader at another app’s pixels in the shared atlas. Glyph runs are referenced once each, in stream order, with their glyph and coordinate ranges in bounds.
- Numbers are finite and bounded. Coordinates, transforms, stroke widths, gradient geometry, layer alpha and glyph sizes.
- Clips nest. Begin and end balance, never deeper than the limit, and a layer leaves none open.
- Work is bounded by the app’s
Limits: paths, segments, draw objects, glyphs.
The pass is O(encoded size) and allocates nothing proportional to it beyond a per-draw marker.
Structs§
- Scene
Cost - What a valid scene costs, for the service’s per-frame budget.
Constants§
- MAX_
COORDINATE - Largest coordinate magnitude a scene may encode. Far beyond any surface; small enough that tile arithmetic on the GPU stays exact.
- MAX_
FONT_ SIZE - Largest glyph size, in pixels per em.
- MAX_
RUN_ COORDS - Variation coordinates of one glyph run (a font has at most a few dozen axes).
Functions§
- validate
- Check
encodingand return what it costs.limitsbounds the cost.