#[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: u32Edge resolution (== chunks[i].res).
verts_per_chunk: u32(res+1)(res+2)/2 — vertices per chunk.
attr_w: u32verts_tex width in texels, for the idx -> (x, y) wrap.
chunk_count: u32Number of chunks in this realize batch.
terrain: TerrainGpuTerrain noise params (shared with the clipmap path); enabled == 0 ⇒
pure geometry (no displacement), the readback reference case.
tile_res: u32Phase 4: per-chunk detail-tile resolution (tile_res × tile_res texels
baked into the colour/normal atlas). Read by ChunkTileBake.slang.
bump_enable: f32Detail-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: f32CPU-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: f32CPU-surface displaced-radius factor per meter: the realize shader multiplies the sampled surface elevation (meters) by this when displacing.
_pad0: f32Tail padding keeping the struct a 16-byte multiple (std430 stride rule).
_pad1: f32Trait Implementations§
Source§impl Clone for ChunkParams
impl Clone for ChunkParams
Source§fn clone(&self) -> ChunkParams
fn clone(&self) -> ChunkParams
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ChunkParams
impl Debug for ChunkParams
Source§impl PartialEq for ChunkParams
impl PartialEq for ChunkParams
Source§fn eq(&self, other: &ChunkParams) -> bool
fn eq(&self, other: &ChunkParams) -> bool
self and other values to be equal, and is used by ==.impl Copy for ChunkParams
impl Pod for ChunkParams
impl StructuralPartialEq for ChunkParams
Auto Trait Implementations§
impl Freeze for ChunkParams
impl RefUnwindSafe for ChunkParams
impl Send for ChunkParams
impl Sync for ChunkParams
impl Unpin for ChunkParams
impl UnsafeUnpin for ChunkParams
impl UnwindSafe for ChunkParams
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
§impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
§type Bits = T
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
fn is_valid_bit_pattern(_bits: &T) -> bool
bits
as &Self.