Skip to main content

celestialsim/chunk_nodes/
realize.rs

1//! `celestial/chunk-realize` — compute dispatch that realizes chunk vertices
2//! from the uploaded descriptors into the shared vertex pool. One thread per
3//! pool vertex (`realize_count * verts_per_chunk`). Mirrors `nodes/realize.rs`.
4
5use crate::chunk_nodes::ChunkNode;
6use crate::chunk_pipeline::ChunkCtx;
7
8pub struct ChunkRealize;
9
10impl ChunkNode for ChunkRealize {
11    fn name(&self) -> &'static str {
12        "celestial/chunk-realize"
13    }
14
15    fn record(&mut self, ctx: &mut ChunkCtx<'_>) {
16        let count = ctx.realize_count;
17        if count == 0 {
18            return;
19        }
20        let vert_threads = count * ctx.gpu.verts_per_chunk();
21        let list = ctx.list();
22        let mut rd = ctx.rd.clone();
23        ctx.gpu.record_realize(&mut rd, list, vert_threads);
24    }
25}