Skip to main content

Module store

Module store 

Source
Expand description

The persistent capture-texture store — the resource that makes layer capture caching possible. Split from render.rs (which stays the pass / composite half): slot structs, allocation, and the per-frame prepare_layer_textures maintenance. Everything is re-exported through super so consumers keep their render::… paths.

Structs§

FilterSlot
A layer’s persistent filter-pass resources: two same-size ping-pong textures (pass 0 samples the capture and writes textures[0], pass 1 samples textures[0] and writes textures[1], and so on) plus the bookkeeping that lets a clean chain skip re-running its passes. Allocated at the capture’s size + format; dies with the LayerSlot on realloc.
LayerAtlases
The per-layer offscreen capture textures (spike: one texture per layer; the planned per-depth shared atlas swaps in behind the same indices). Index-aligned with ExtractedUiLayers::layers; entries are clones of the persistent LayerTextureStore slots.
LayerSlot
One layer’s persistent capture texture. Unlike Bevy’s TextureCache (descriptor-keyed pool — same-size layers can swap textures between frames, and nothing pins content), a slot is keyed by the layer root’s MainEntity, so a clean layer’s texture reliably still holds last frame’s capture.
LayerTextureStore
Persistent (cross-frame) capture textures, keyed by layer root — the resource that makes capture caching possible. Slots are allocated / reallocated by prepare_layer_textures and evicted a few frames after their layer disappears (demote, despawn).

Functions§

prepare_layer_textures
Maintains the persistent per-layer capture textures (camera target format — stolen pipelines were specialized against it; sample count 1 — ui_pass renders unsampled): get-or-(re)allocate each live layer’s LayerTextureStore slot, mirror it into the index-aligned LayerAtlases, and evict slots whose layer is gone. Also owns the FilterSlot lifecycle: ping-pong textures allocated while the layer has a chain, cleared (with their version bookkeeping — load-bearing, see the in-body comment) when it doesn’t. Deliberately not Bevy’s TextureCache — capture caching needs each layer to keep its own texture (and its pixels) across frames.