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 retained 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). A backdrop blur
is a layer of its own holding one draw — its rectangle’s coverage under
whatever clip is open, painted by nothing the compiler resolves — listed in
CompiledFrame::backdrops for the scheduler and the renderer to cut the
frame at and to paint from the blurred page (see
crate::filters’ The backdrop blur).
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::RetainedBracket;pub use layers::RetainedKind;pub use layers::RetainedPlacement;pub use layers::RetainedStack;
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, retained 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
Quad - One glyph drawn as a glyph quad: the whole-pixel rectangle its single
rect instance covers, and the atlas texel under that rectangle’s top-left
corner (see [
crate::text]’s backend for when a glyph is one). - 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.
Constants§
- DEFAULT_
PARALLEL_ MIN_ COST - The estimated cost a frame’s planned work must reach before a helper is spawned for it.
- DEFAULT_
PARALLEL_ WORKERS - The most threads a frame’s strip generation runs on, the calling thread included, before the machine’s own parallelism caps it.
- MAX_
PARALLEL_ WORKERS - The most threads
crate::compile::SceneCompiler::set_parallel_workersaccepts, the walk included: a caller’s count past this is a mistake, not a bigger machine, and a count past the machine only pays for threads that cannot run. The variable’s path is capped by the machine instead. - MAX_
RESIDENT_ GLYPH_ RUNS - The most glyph runs a compiler’s resident-run cache remembers at once (see
SceneCompiler::resident_glyph_run_count). A byte budget bounds the same records alongside it, so a scene of very long runs is held to fewer.
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.