Skip to main content

GpuSceneResident

Struct GpuSceneResident 

Source
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: u32

Words per occupancy page (a multiple of occ_words_per_slot).

§occupancy_num_pages: u32

Number 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: Buffer

GPU.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

Source

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).

Source

pub fn resident_bytes(&self) -> u64

Source

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.

Source

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§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,