Skip to main content

GridStaticMeta

Struct GridStaticMeta 

Source
#[repr(C)]
pub struct GridStaticMeta {
Show 23 fields pub occupancy_offset: u32, pub color_offsets_offset: u32, pub colors_offset: u32, pub chunk_colors_base_offset: u32, pub chunk_occupancy_offset: u32, pub slot_chunk_idx_offset: u32, pub vsid: u32, pub total_slots: u32, pub pool_dims: [u32; 3], pub _pad0: u32, pub occ_words_per_slot: u32, pub offsets_words_per_slot: u32, pub mip_count: u32, pub _pad1: u32, pub mip_occ_rel: [u32; 6], pub mip_coff_rel: [u32; 6], pub aabb_min: [i32; 3], pub _pad2: i32, pub aabb_max: [i32; 3], pub _pad3: i32, pub chunk_occ_mip_off: [u32; 4], pub chunk_occ_levels: u32, pub _pad4: [u32; 3],
}
Expand description

Per-grid static metadata: offsets into the concatenated storage buffers + the grid’s slot-pool dimensions. Uploaded once.

GPU.7 changes: chunks_dims and origin_chunk were dropped. The shader uses modular slot indexing (chunk_idx & (pool_dims - 1)) and verifies slot identity via slot_chunk_idx[slot], so the upload-time bbox is no longer relevant to the shader.

Fields§

§occupancy_offset: u32

occupancy u32-word offset where this grid’s data starts.

§color_offsets_offset: u32

all_color_offsets (binding 2) u32-word offset where this grid’s per-slot colour-offset tables start; slot meta_id’s window is offsets_words_per_slot words from color_offsets_offset + meta_id * offsets_words_per_slot.

§colors_offset: u32

all_colors (binding 3) u32-word offset where this grid’s packed voxel colours start (per-slot blocks of the grid’s colour stride).

§chunk_colors_base_offset: u32

all_chunk_colors_base (binding 4) u32-word offset of this grid’s per-slot table mapping meta_id → the slot’s colour base (in words, relative to colors_offset).

§chunk_occupancy_offset: u32

all_chunk_occupancy (binding 5) u32-word offset of this grid’s chunk-occupancy bitmap: bit slot_idx & 31 of word slot_idx >> 5 is set iff the slot holds a non-empty chunk — the outer DDA’s whole-chunk skip test.

§slot_chunk_idx_offset: u32

New in GPU.7: u32-word offset where this grid’s slot_chunk_idx array starts (one vec3<i32> per slot, i.e. 3 u32 words each, plus 1 padding word for std430).

§vsid: u32

Chunk XY extent in voxels (typically 128); the chunk’s Z extent is the fixed CHUNK_Z = 256.

§total_slots: u32

Slot count in the modular pool (pool_dims.x · pool_dims.y · pool_dims.z).

§pool_dims: [u32; 3]

GPU.7 slot-pool dimensions (each a power of 2). Chunk (chx, chy, chz) lives in slot (chx & (pool_dims.x - 1), chy & …, chz & …).

§_pad0: u32

std430 padding; always 0.

§occ_words_per_slot: u32

GPU.11 — per-slot occupancy stride (sum over all mips). meta_id’s occupancy slab starts at occupancy_offset + meta_id * occ_words_per_slot.

§offsets_words_per_slot: u32

GPU.11 — per-slot color_offsets stride (sum over all mips).

§mip_count: u32

GPU.11 — number of mip levels stored per slot.

§_pad1: u32

std430 padding; always 0.

§mip_occ_rel: [u32; 6]

GPU.11 — within-slot u32 offset where mip m’s occupancy starts. mip_occ_rel[0] == 0 so mip-0 reads are unchanged.

§mip_coff_rel: [u32; 6]

GPU.11 — within-slot u32 offset where mip m’s color_offsets start. mip_coff_rel[0] == 0.

§aabb_min: [i32; 3]

GPU.13.0 — occupied chunk-AABB (inclusive) in chunk-index space. The outer DDA stops once p_chunk passes this box along the ray’s travel direction (no resident chunk can lie ahead). An empty grid uses the inverted sentinel (aabb_min = i32::MAX, aabb_max = i32::MIN) so every ray early-outs immediately. Maintained live: GpuSceneResident::refresh_chunk / GpuSceneResident::evict_chunk recompute + re-upload it.

§_pad2: i32

std430 vec3<i32> padding; always 0.

§aabb_max: [i32; 3]

Inclusive upper corner of the occupied chunk-AABB (chunk-index space); i32::MIN sentinel when the grid holds no chunks. See Self::aabb_min.

§_pad3: i32

std430 vec3<i32> padding; always 0.

§chunk_occ_mip_off: [u32; 4]

GPU.13.1 — all_chunk_occupancy u32-word offsets of this grid’s chunk-occupancy pyramid levels 1..=4 (entry l - 1 = level l; entries past Self::chunk_occ_levels are 0). Level l has max(pool_dims >> l, 1) cells per axis; a set bit means “some resident non-empty chunk maps into this slot-block” — the outer DDA’s read-free empty-block skip.

§chunk_occ_levels: u32

GPU.13.1 — pyramid levels stored above L0 (0 = no pyramid, the single-chunk-pool degenerate case).

§_pad4: [u32; 3]

std430 padding; always 0.

Trait Implementations§

Source§

impl Clone for GridStaticMeta

Source§

fn clone(&self) -> GridStaticMeta

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for GridStaticMeta

Source§

impl Debug for GridStaticMeta

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Pod for GridStaticMeta

Source§

impl Zeroable for GridStaticMeta

Source§

fn zeroed() -> Self

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> AnyBitPattern for T
where T: Pod,

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> CheckedBitPattern for T
where T: AnyBitPattern,

Source§

type Bits = T

Self must have the same layout as the specified Bits except for the possible invalid bit patterns being checked during is_valid_bit_pattern.
Source§

fn is_valid_bit_pattern(_bits: &T) -> bool

If this function returns true, then it must be valid to reinterpret bits as &Self.
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> NoUninit for T
where T: Pod,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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,