Skip to main content

Module render

Module render 

Source
Expand description

The render pass (docs/ARCHITECTURE.md §七): every solved placement of every frame resolved to its final canvas and pose, checked against the frames either side of it, and painted into the tile cache by the Compositor.

A RenderSession holds what the pass keeps for its whole length: the region table, the attachment chain, a three-slot frame ring (previous, current, lookahead), the world-consistency mask, the last-painted pixels of every fixed region, the last placement of every layer, a four-slot window over solve’s voting records, and the canvas metadata the pass updates. The host drives it one frame at a time:

  1. RenderSession::wanted_votes names the consistency/<frame> records the window does not hold yet; the host reads them and hands them to RenderSession::begin with the frame’s plan and its neighbours’ plans.
  2. RenderSession::step runs the frame’s placements in order until it needs something only the host has: a canvas’s stored metadata (RenderStep::NeedMeta → RenderSession::provide_meta), a decoded frame’s pixels (RenderStep::NeedFrame → write them into RenderSession::frame_slot), a tile or a canvas’s temporal records (the compositor’s own needs, passed through), and returns RenderStep::Done with the frame’s observation row once every placement is through.
  3. RenderSession::take_events after every step (also a failed one) returns the diagnostics raised so far, in emission order; RenderSession::take_dirty_metas on the host’s flush cadence returns the canvases whose metadata changed since the last flush, in first-changed order.

The session borrows the tile cache, the compositor and the pose graph for each step (a RenderIo); it owns none of them, so the host keeps flushing tiles and temporal records exactly as before. It reads no clock: now comes with every step and only stamps the tiles it writes.

Frames enter the ring only when a placement first needs them, and a new frame takes the slot filled longest ago among those holding none of the frame in progress and its two neighbours. A placement keeps the slots it was given while it loads the frames it still lacks, so a slot one of them holds must not be reused. After two frames that paint nothing, the next frame t loads itself before frame t−1; reusing plainly the slot filled longest ago then put frame t+2 into frame t’s slot while frame t+1 still compared against it, so frame t+1’s mask read frame t+2’s pixels in frame t’s place.

Re-exports§

pub use crate::engine::solve::is_valid_pose;
pub use crate::engine::solve::POSE_BOUND;

Structs§

CanvasMeta
The fields of a canvas’s stored metadata (canvas/<id>) the render pass updates; the host keeps the rest of the row and writes these back into it.
ConsistencyVote
Solve’s displacement-spread verdict for one region of one frame (consistency/<frame>, docs/ARCHITECTURE.md §七): the analysis-resolution box it scored and two bitsets over it, LSB first — cells found inconsistent, cells found confidently consistent.
FrameInput
What the host knows about one frame when it composites it.
FrameOutcome
What a finished frame leaves the host: its ledger row, and the canvas of the last moving-region placement it painted or reused (the progress event’s canvas), if any.
FramePlan
What render reads of a stored plan.
Observation
The observation/<frame> row.
PlanPlacement
One placement of a stored plan (plan/<frame>), in the row’s field order. skip and occlusions are absent from the row unless set, and stay absent in the observation row built from it.
RenderConfig
Run-wide constants of a session.
RenderCounters
The pass-level counters a step changes, cumulative over the session.
RenderDecision
One placement’s line in the observation ledger (observation/<frame>): the canvas it targeted, its final render-time placement, and either its pixel contribution or which shortcut skipped painting it.
RenderIo
What the session borrows for one step.
RenderRegion
One region of the run’s atlas.
RenderSession

Enums§

RegionKind
RenderError
RenderStep

Constants§

RING_FRAMES
Frames the ring holds: the previous, the current and the lookahead frame.
VOTING_WINDOW
Voting records the window keeps: a frame and both neighbours, plus one, so consecutive frames read one new record each.

Type Aliases§

ConsistencyRecord
One frame’s consistency/<frame> record, by region id.