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.
§Panics
If info.grids.len() > MAX_SCENE_GRIDS.
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.
Auto Trait Implementations§
impl !Freeze for GpuSceneResident
impl !RefUnwindSafe for GpuSceneResident
impl !UnwindSafe for GpuSceneResident
impl Send for GpuSceneResident
impl Sync for GpuSceneResident
impl Unpin for GpuSceneResident
impl UnsafeUnpin for GpuSceneResident
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.