pub fn merge_stage(
pending: &mut ChunkStage,
new: ChunkStage,
budget_chunks: usize,
)Expand description
Merge a newly staged batch into a still-pending one instead of replacing it.
The main thread stages every frame while streaming, but the render thread
consumes asynchronously; a plain stage = Some(new) DROPPED any unconsumed
batch — those chunks were already marked clean in the cache and kept their
slots, so they were drawn forever with uninitialized pool memory (the giant
garbage-triangle walls). Realize work is cumulative (descriptors + surface
patches + scatter aux append); the instance set, surface globals and scatter
visible/params are snapshots (latest wins). If the merged batch exceeds
budget_chunks (render thread stalled for hundreds of frames), the OLDEST
realizes are dropped — they re-dirty naturally.