Skip to main content

snap_frame_rects

Function snap_frame_rects 

Source
pub fn snap_frame_rects(
    prim_store: &mut PrimitiveStore,
    prim_instances: &[PrimitiveInstance],
    clip_tree: &mut ClipTree,
    draws: &mut [PrimitiveDrawHeader],
    spatial_tree: &SpatialTree,
)
Expand description

Snap all per-frame rect state that depends on the current spatial tree: each prim’s snapped_local_rect (into draws), each cluster’s snapped_bounding_rect, each prim’s clip-leaf rect, and each clip-tree node’s rect. All snapping happens against the root reference frame in the rect’s own spatial-node space, mirroring the scene-build helper this replaces.

Per-prim clip leaves are snapped inside the cluster loop, against the cluster’s spatial node — the leaf’s local clip rect lives in the prim’s local space, and clusters group prims by spatial node, so the cluster’s (resolved) spatial node is the correct snap target. This matters for backdrop-filter capture leaves where the prim’s clip-leaf spatial node would otherwise be UNKNOWN: the cluster is resolved by finalize_picture before this pass runs.