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::BlurredRoundedRectto avello_commonEncodedPaint::BlurredRoundedRectentry, 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::Brushto avello_commonPaintplus itsEncodedPaintside table.
Structs§
- Compile
Spans - What one
SceneCompiler::compilecall spent, phase by phase. - Compiled
Frame - Everything one compiled frame produced.
- Glyph
Slot - Where one glyph an atlas-routed draw sampled lives in the atlas array.
- Scene
Compiler - Compiles a
frust_scene::Sceneinto strips and draws.
Functions§
- dash_
cycle_ is_ normalizable - Whether a dash pattern’s derived cycle survives kurbo’s own normalization
arithmetic, so
kurbo::dashterminates instead of spinning forever. - dash_
path pathexpanded into the sub-pathsdashbreaks it into.- shader_
quad_ texture_ id - The id the offscreen target of fragment program
program_idis registered under — the compiler’s half of the agreementcrate::effects::shader_quadmakes with the pre-pass that renders it. - well_
formed elementsas a path every consumer can read: opened by aMoveTo, and carrying noClosePaththat closes a subpath with no segments in it.