Expand description
Render world definitions and the extract pipeline.
§Worlds
- Main world (
App::world): UI state, layout, scripts. Tick stages:Input -> CommandDrain -> Systems -> LayoutSync -> A11ySync. - Render world (
App::render_world): per-frame extracted draw data, GPU resource caches, renderer state. Tick stages:Prepare -> Render.
§Extract step
After the main schedule and before the render schedule, the registered chain of ExtractFn entries runs.
Each function takes (&mut World, &mut World) and copies or upserts draw data from the main world into the render world.
§Drawable model
Each render-world entity represents one drawable. Adding a primitive consists of: one Extracted* component, one extract fn, and one render system.
Structs§
- Animations
Active - Per-tick flag raised by animation drivers (hover / press tweens, opacity transitions, scroll inertia) while a value is still in motion.
- Extract
Context Cache - Per-extract-phase memo of the parent-derived maps that every extract fn recomputes identically within a single frame.
- Extract
Schedule - Schedule label for the dedicated extract schedule on the render world.
- Extracted
Border - CSS border for one entity: per-side widths, one solid color, painted
between the outer border-box edge and the padding box (inside the
rect, unlike
ExtractedOutlinewhich strokes centered on the box edge). Emitted byextract_bordersat the entity’s ownPaintOrder; the IR builder pushes borders after rects, so at the shared order key the border paints above the background fill and below all descendants - CSS’s background -> border -> content order. - Extracted
Clip Box - One rectangular clip region constraining descendant paints.
- Extracted
Image - One decoded image to render this frame in RGBA8 row-major pixels.
The renderer wraps
rgbain apeniko::Blobwhose stable identity keys the vello/wgpu upload cache across frames. - Extracted
Outline - Stroked outline ring rendered around an entity (typically when
crate::input::Focused). - Extracted
Rect - One filled rectangle to render this frame.
- Extracted
Scrollbar - Overlay-scrollbar draw list for one scroll container (spec section 16.2 /
section 16.6). Emitted by
extract_scrollbars; the IR builder appends the rects - indrawsorder - AFTER every other leaf sharing the samePaintOrder, so bars always paint above the container’s content (theorderis the container’smax descendant order + 1, which also places them outside the container’s clip bracket - overlay bars are never clipped by their own viewport). - Extracted
Shadow - Shadow extracted for one entity. The renderer draws it at
order = rect.order - 1so it appears underneath the source rect without bleeding onto unrelated siblings. - Extracted
Text - One text run to render this frame.
- Frame
Damage - Per-frame list of damage rectangles for partial-redraw / dirty-region rendering.
- Frame
Dirty - Per-frame flag indicating that the upcoming frame requires a fresh GPU encode.
- Hidden
Extracts - Render-world snapshot of the set of MAIN-world entities that are hidden by
a [
Visible(false)] on themselves or any ancestor (CSSvisibility: hiddensemantics - the box keeps its layout space but paints nothing). - Overlay
Layer - Marker component lifting an entity and its whole subtree into the top-layer paint band (browser top-layer / Qt popup-window semantics): the subtree paints after ALL normal tree content regardless of its document position, keeps its internal document order, and escapes ancestor clip / scroll-cull rects (its own internal clips still apply).
- Overlay
Open Order - Main-world resource tracking the order in which
OverlayLayerroots became visible, so concurrently open popups stack later-opened-on-top (like OS popup windows). - Rect
- Axis-aligned rectangle in logical pixel coordinates. Used by
FrameDamage. - Render
- Schedule label for the render schedule.
- Render
Entity Map - Persistent map from a main-world entity to its render-world entity for each
Extracted*type. Upserting extracts read the prior map, update render entities in place, and write the new map back; legacy despawn-and-respawn extracts leave their slot untouched. - Scrollbar
Draw Rect - One rounded solid rect of an overlay scrollbar (track or thumb).
- Surface
Capture - Coordination handle for on-screen surface screenshots, inserted as a
Resourceinto both worlds. - Surface
Frame - One CPU-side snapshot of the on-screen window surface produced by a GPU->CPU readback.
- Viewport
- Window viewport, inserted as a
Resourceinto both the main and render worlds. The window plugin writes both copies on every resize.
Enums§
- Brush
- Fill brush for an
ExtractedRect. Gradient variants store their stops in anArc<[...]>so cloning the brush bumps the Arc instead of deep-copying. - Extract
Set SystemSetlabel for render-world extract systems registered viacrate::app::App::add_extract_systems.- Render
Stage - Ordered stages inside the
Renderschedule.
Constants§
- DEFAULT_
SELECTION_ BG - Single built-in fallback for the selection highlight when no
selection-colortoken is set - the platform “highlight” blue at ~40 % alpha (mirrors macOS / web selection tints and Qt’sHighlightrole). Translucent on purpose so the text underneath keeps its contrast, so noselection-text-coloris required for legibility. Skins override the whole look via the--lumen-selectiontoken; this is the one Rust fallback. - OVERLAY_
ORDER_ BASE - First
PaintOrderof the top-layer band. Every rank in anOverlayLayersubtree is>= OVERLAY_ORDER_BASE; every normal-tree rank is below it (real UI trees are nowhere near0x2000_0000entities), so overlay content always paints after all normal content.
Functions§
- build_
parent_ map - Returns
(parent_map, document_order_map)used by every extract fn to computePaintOrderconsistently. - clear_
extracted - Despawns transient render-world entities carrying
Extracted*components, called once per frame before anyExtractFnruns. - cull_
hidden - Prepare-stage guard that despawns every extracted render entity whose
owning main entity is hidden (per
HiddenExtracts), then drops those entries fromRenderEntityMapso the next frame’s keyed upserts start clean. Runs beforecrate::node_ir::transform_extracted_to_nodesso no hidden leaf reaches the retained tree. - cull_
offscreen - Despawns extracted entities whose AABB lies fully outside the
Viewport. - extract_
borders - Extract fn that emits one
ExtractedBorderper main-world entity carrying aTransformand aVisuals::border. A border paints even when the entity has no background fill (CSS:background: none; border: 1px solid ...still draws the border). Logical border edges (border-inline-*) are resolved against the entity’scrate::components::ResolvedDirection. - extract_
clips - Extracts one
ExtractedClipBoxper clipping entity (carryingcrate::input::ScrollorStyle.overflow_x/overflow_y == Hidden). Each emission carries the containing rect plus the(start_order, end_order)range bracketing descendant paints so the renderer can push/pop a vello layer. - extract_
rects - Default extract fn that emits one
ExtractedRectper main-world entity carrying aTransformand aVisuals::fill. - extract_
scrollbars - Extract fn emitting one
ExtractedScrollbarpercrate::input::Scrollcontainer whose content overflows on an allowed axis and whose fade alpha is above zero. Geometry comes from the sharedcrate::input::vertical_scrollbar/crate::input::horizontal_scrollbarmath so painted pixels and hit regions always agree. All visuals (colors, thickness, minimums) resolve throughcrate::input::ScrollbarStyle- CSSscrollbar-color/scrollbar-widthper container, with the component’sDefaultas the no-stylesheet fallback. - extract_
shadows - Extract fn that emits one
ExtractedShadowper entry inVisuals::shadows. Each shadow is placed atrect.order - 1 + idxso it paints under the source rect and stacked shadows keep source order. - extract_
text - Default extract fn that emits one
ExtractedTextper entity withTransformandTextContent. - hidden_
entities - Returns the set of entities hidden by a [
Visible(false)] on themselves or any ancestor. - paint_
order_ of - Returns the
PaintOrderfore- the document-order rank precomputed bybuild_parent_map(whose second return value is the map passed here ascache). - parent_
opacities - Returns each entity’s cumulative ANCESTOR opacity product (own
Opacityexcluded - extract fns already fold that in). CSS semantics:opacitymultiplies down the subtree, so fading a dialog root fades every descendant. Returns an empty map when no entity carries anOpacity(the overwhelmingly common case - extracts then skip the lookup entirely). - parent_
scroll_ clip_ rects - Returns the nearest clipping-ancestor rect (origin and size in window coordinates) for every entity.
- parent_
scroll_ offsets - Returns each entity’s cumulative ancestor-chain
ScrollOffset. - reset_
animations_ active - Clears
AnimationsActiveat the top of every tick (registered incrate::tick::TickStage::Input, which is chained before theSystemsstage where animation drivers run). Recomputing the flag from scratch each tick is what guarantees idle-quiescence: a tick with no live animation leaves itfalse. - roll_
up_ frame_ dirty - Rolls up render-relevant change signals into
FrameDirty. Runs each tick incrate::tick::TickStage::A11ySync; the window backend reads the flag right before encoding and clears it after submission. - stash_
hidden_ entities - Extract fn: recompute the hidden-subtree set from the main-world hierarchy
and mirror it into the render world for
cull_hidden.
Type Aliases§
- Extract
Fn - Function pointer for an extract step. Stateless; closures are disallowed, so per-extract state lives in render-world resources.
- Paint
Order - Painter-algorithm sort key for
Extracted*entries. Higher values paint later (closer to the viewer).