pub struct GpuChunkResident {
pub vsid: u32,
pub occupancy: Buffer,
pub color_offsets: Buffer,
pub colors: Buffer,
pub occupancy_bytes: u64,
pub color_offsets_bytes: u64,
pub colors_bytes: u64,
/* private fields */
}Expand description
GPU-side storage for one decompressed chunk. Owns its buffers; dropping releases them.
Fields§
§vsid: u32XY extent of the chunk in voxels (typically 128). Copied from
ChunkUpload::vsid; the probe shader needs it to index columns.
occupancy: BufferStorage buffer holding ChunkUpload::occupancy: 1 bit per
voxel, bit(x, y, z) = (word[i >> 5] >> (i & 31)) & 1 with
i = x + y*vsid + z*vsid*vsid.
color_offsets: BufferStorage buffer holding ChunkUpload::color_offsets:
vsid² + 1 u32s; column (x, y)’s colours span
colors[offsets[x + y*vsid] .. offsets[x + y*vsid + 1]].
colors: BufferStorage buffer holding ChunkUpload::colors: one packed u32
per solid voxel in ascending-z column order — voxlap wire format
(blue in bits 0-7, green 8-15, red 16-23, brightness 24-31 with
0x80 = neutral).
occupancy_bytes: u64Size of Self::occupancy in bytes (word count × 4), for
memory accounting.
color_offsets_bytes: u64Size of Self::color_offsets in bytes.
colors_bytes: u64Size of Self::colors in bytes.
Implementations§
Source§impl GpuChunkResident
impl GpuChunkResident
Sourcepub fn upload(device: &Device, chunk: &ChunkUpload) -> Self
pub fn upload(device: &Device, chunk: &ChunkUpload) -> Self
Upload chunk to device. Single-shot allocation; no
streaming machinery yet — that arrives in GPU.6 / GPU.7.
Sourcepub fn resident_bytes(&self) -> u64
pub fn resident_bytes(&self) -> u64
Total resident bytes (occupancy + offsets + colours) — for the upload-time benchmark.
Sourcepub fn read_voxel_blocking(
&self,
device: &Device,
queue: &Queue,
x: u32,
y: u32,
z: u32,
) -> Option<u32>
pub fn read_voxel_blocking( &self, device: &Device, queue: &Queue, x: u32, y: u32, z: u32, ) -> Option<u32>
Round-trip read of a single voxel via the debug shader.
Returns Some(rgb) for a solid voxel (textured or bedrock),
None for empty / out-of-bounds.
Blocks until the GPU finishes; not intended for the render hot path. The GPU.2 validation test is the only caller (native).