pub struct GpuSceneResident {
pub grid_count: u32,
pub occupancy_pages: Vec<Buffer>,
pub occupancy_page_words: u32,
pub occupancy_num_pages: u32,
pub all_color_offsets: Buffer,
pub all_colors: Buffer,
pub all_chunk_colors_base: Buffer,
pub all_chunk_occupancy: Buffer,
pub all_slot_chunk_idx: Buffer,
pub grid_static_meta: Buffer,
pub total_bytes: u64,
pub static_meta: Vec<GridStaticMeta>,
/* private fields */
}Expand description
GPU-resident storage for an entire scene’s grids.
Fields§
§grid_count: u32§occupancy_pages: Vec<Buffer>Concatenated per-slot occupancy, split into up to
MAX_OCC_PAGES storage bindings so no single binding
exceeds the device’s max_storage_buffer_binding_size. The
vec is always exactly MAX_OCC_PAGES long — pages past
occupancy_num_pages are 1-word dummies kept only so the
bind group has a buffer for every layout entry. Page p holds
the global word range [p*occupancy_page_words, (p+1)*occupancy_page_words); occupancy_page_words is a
whole number of chunk slots so no slot straddles a boundary.
occupancy_page_words: u32Words per occupancy page (a multiple of occ_words_per_slot).
occupancy_num_pages: u32Number of real (non-dummy) pages in occupancy_pages.
all_color_offsets: Buffer§all_colors: Buffer§all_chunk_colors_base: Buffer§all_chunk_occupancy: Buffer§all_slot_chunk_idx: BufferGPU.7 — per-slot chunk_idx for identity verification in the
shader. Stored as vec3<i32> with std430 16-byte stride
(each entry is [i32; 4] on the host: x, y, z, _pad).
grid_static_meta: Buffer§total_bytes: u64§static_meta: Vec<GridStaticMeta>Cached static metadata for the host’s frame-loop work.
Implementations§
Source§impl GpuSceneResident
impl GpuSceneResident
Sourcepub fn upload(device: &Device, info: &SceneUpload) -> Self
pub fn upload(device: &Device, info: &SceneUpload) -> Self
Pack + upload info. Each grid is uploaded as a contiguous
slab inside the shared storage buffers; per-grid offsets
live in grid_static_meta. The grid count is bounded only by
the device’s storage-buffer limits (per-grid cameras + metadata
are runtime-sized storage arrays, not a fixed shader array).
pub fn resident_bytes(&self) -> u64
Sourcepub fn refresh_chunk(
&mut self,
queue: &Queue,
scene_idx: usize,
chunk_idx: [i32; 3],
chunk: &ChunkUpload,
) -> RefreshOutcome
pub fn refresh_chunk( &mut self, queue: &Queue, scene_idx: usize, chunk_idx: [i32; 3], chunk: &ChunkUpload, ) -> RefreshOutcome
Install or refresh a chunk in its modular pool slot. GPU.7
generalises GPU.6’s in-place refresh: any chunk_idx maps to
a slot via chunk_idx & (pool_dims - 1). The previous
occupant (if a different chunk) is silently replaced — the
host is responsible for guaranteeing that the pool is sized
large enough that two simultaneously-resident chunks never
collide on the same slot.
Sourcepub fn evict_chunk(
&mut self,
queue: &Queue,
scene_idx: usize,
chunk_idx: [i32; 3],
) -> bool
pub fn evict_chunk( &mut self, queue: &Queue, scene_idx: usize, chunk_idx: [i32; 3], ) -> bool
Evict a chunk’s slot — clear its chunk_occupancy bit and
reset slot_chunk_idx to the empty sentinel. Used by the
host when a chunk disappears from the CPU-side Grid::chunks
(e.g. streaming eviction past r_evict).
Returns false if scene_idx is past grid_count (no-op);
true otherwise.