Skip to main content

ChunkParams

Struct ChunkParams 

Source
#[repr(C)]
pub struct ChunkParams { pub res: u32, pub verts_per_chunk: u32, pub attr_w: u32, pub chunk_count: u32, pub terrain: TerrainGpu, pub tile_res: u32, pub bump_enable: f32, pub surface_enabled: f32, pub surface_height_scale: f32, pub _pad0: f32, pub _pad1: f32, }
Expand description

Realize-batch parameters + embedded terrain, byte-identical to struct ChunkParams in shaders/ChunkRealize.slang / ChunkTileBake.slang (binding 1).

std430 layout: a 4-u32 header { res, verts_per_chunk, attr_w, chunk_count } (16 bytes) immediately followed by the 16-float TerrainGpu (64 bytes) at offset 16. tile_res (Phase 4) sits at offset 80, bump_enable at 84, and the CPU-surface surface_enabled/surface_height_scale at 88/92, filling the struct to 96 bytes — a multiple of 16, as the std430 struct-array rule requires. #[repr(C)] matches because u32/f32 are 4-aligned and the fields tile the tail with no interior holes (bytemuck Pod).

ChunkRealize.slang still declares the original 80-byte ChunkParams; it only reads fields at offsets 0..80, so the appended tile_res+pad are invisible to it and its committed SPIR-V stays valid (only params[0] is read, so the array stride never matters there).

The chunk_params_layout test locks these offsets.

Fields§

§res: u32

Edge resolution (== chunks[i].res).

§verts_per_chunk: u32

(res+1)(res+2)/2 — vertices per chunk.

§attr_w: u32

verts_tex width in texels, for the idx -> (x, y) wrap.

§chunk_count: u32

Number of chunks in this realize batch.

§terrain: TerrainGpu

Terrain noise params (shared with the clipmap path); enabled == 0 ⇒ pure geometry (no displacement), the readback reference case.

§tile_res: u32

Phase 4: per-chunk detail-tile resolution (tile_res × tile_res texels baked into the colour/normal atlas). Read by ChunkTileBake.slang.

§bump_enable: f32

Detail-normal bump enable (1.0 on, 0.0 off): a debug toggle that removes the high-frequency normal perturbation from the baked normal atlas. Read by ChunkTileBake.slang; invisible to ChunkRealize.slang (offset > 80).

§surface_enabled: f32

CPU-surface global toggle at offset 88: 1.0 ⇒ the chunk shaders sample the per-chunk surface color/height storage buffers instead of the procedural surface; 0.0 ⇒ pixel-identical to the procedural path.

§surface_height_scale: f32

CPU-surface displaced-radius factor per meter: the realize shader multiplies the sampled surface elevation (meters) by this when displacing.

§_pad0: f32

Tail padding keeping the struct a 16-byte multiple (std430 stride rule).

§_pad1: f32

Trait Implementations§

Source§

impl Clone for ChunkParams

Source§

fn clone(&self) -> ChunkParams

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 Debug for ChunkParams

Source§

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

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

impl PartialEq for ChunkParams

Source§

fn eq(&self, other: &ChunkParams) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Zeroable for ChunkParams

§

fn zeroed() -> Self

Source§

impl Copy for ChunkParams

Source§

impl Pod for ChunkParams

Source§

impl StructuralPartialEq for ChunkParams

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
§

impl<T> CheckedBitPattern for T
where T: AnyBitPattern,

§

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

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

impl<T> AnyBitPattern for T
where T: Pod,

§

impl<T> NoUninit for T
where T: Pod,