Skip to main content

prepare_layer_textures

Function prepare_layer_textures 

Source
pub fn prepare_layer_textures(
    extracted: Res<'_, ExtractedUiLayers>,
    render_device: Res<'_, RenderDevice>,
    pipeline_cache: Res<'_, PipelineCache>,
    phases: Res<'_, ViewSortedRenderPhases<TransparentUi>>,
    store: ResMut<'_, LayerTextureStore>,
    atlases: ResMut<'_, LayerAtlases>,
)
Expand description

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.