Skip to main content

Module compile

Module compile 

Source
Expand description

Scene compilation: a frust_scene::Scene becomes sparse strips plus draws.

SceneCompiler is a stateless walk over an already-recorded display list. Unlike an immediate-mode scene recorder, there is no render state to save and restore and no transform stack to unwind — frust_scene::SceneBuilder has already composed every command’s transform, so each command carries the only transform it needs and the walk composes it with the frame’s root once.

The compiler owns the retained scratch a StripGenerator needs (line buffer, tiles, flatten/stroke context) so a steady-state frame reuses those allocations, and the two pieces of state that genuinely span frames — the ImageResidency that keeps an image’s atlas rectangle alive for as long as the scene keeps drawing it, and the GlyphPrepCache that keeps a glyph’s fetched outline and its font’s hinting instance alive on the same terms. Everything else is per-frame: compile returns what a frame produced in one CompiledFrame and keeps nothing of it.

Compiled here: the geometry primitives — axis-aligned and rounded rectangles, lines, arbitrary filled/stroked paths — the clip bracket around them, which lowers to a scissor rectangle or a coverage mask and never to an intermediate texture (see clip), the opacity-layer and snapshot brackets that group them (see layers), the hole punch that erases what they painted (see clear), images, whose destination rectangle is rasterized like any other fill and painted by an atlas-backed image paint (see paint and crate::cache::images), and blurred rounded rectangles, whose padded bounding rectangle is rasterized the same way and painted by a gaussian-falloff paint the fragment shader evaluates per pixel (see blur_rrect), and glyph runs, which take one of two routes decided per run by [crate::text::atlas_policy] before the walk begins: a settled run is resolved through the glyph atlas and each glyph drawn as one image paint over its slot, while an animating, oversized or refused one has its outlines fetched and scaled by glifo and rasterized as any other filled path would be, painted by the run’s own brush (see [crate::text]). Shader quads are recognised and skipped — the engine grows them in a later pass, and skipping is the conservative behaviour (a frame draws less, never wrong).

Re-exports§

pub use clear::ClearPunch;
pub use clip::ClipStack;
pub use draw::DepthCounter;
pub use draw::EngineDraw;
pub use external::ExternalExtents;
pub use external::ExternalSkip;
pub use layers::GroupStack;
pub use layers::LayerLowering;
pub use layers::SnapshotStack;

Modules§

blur_rrect
Blurred rounded rectangle encoding: Command::BlurredRoundedRect to a vello_common EncodedPaint::BlurredRoundedRect entry, plus the padded bounding rectangle a strip generator rasterizes it through.
clear
ClearRect: the platform-view hole punch, hoisted to the frame root and lowered to destination-out coverage.
clip
The compiler’s clip stack, and the two shapes a clip lowers to.
draw
The engine’s draw record and its depth counter.
external
Lowering for Command::SceneTexture: a caller-owned GPU texture drawn over a destination rectangle.
layers
Opacity layers, snapshot brackets, and the bracket stack they share with clips.
paint
Paint encoding: peniko::Brush to a vello_common Paint plus its EncodedPaint side table.

Structs§

CompileSpans
What one SceneCompiler::compile call spent, phase by phase.
CompiledFrame
Everything one compiled frame produced.
GlyphSlot
Where one glyph an atlas-routed draw sampled lives in the atlas array.
SceneCompiler
Compiles a frust_scene::Scene into strips and draws.

Functions§

dash_cycle_is_normalizable
Whether a dash pattern’s derived cycle survives kurbo’s own normalization arithmetic, so kurbo::dash terminates instead of spinning forever.
dash_path
path expanded into the sub-paths dash breaks it into.
shader_quad_texture_id
The id the offscreen target of fragment program program_id is registered under — the compiler’s half of the agreement crate::effects::shader_quad makes with the pre-pass that renders it.
well_formed
elements as a path every consumer can read: opened by a MoveTo, and carrying no ClosePath that closes a subpath with no segments in it.