Skip to main content

Module instance_culling

Module instance_culling 

Source
Expand description

Caller-buffered CPU frustum visibility lists with stable source-index indirection. Canonical packed instance ABI and deterministic visibility delegation.

Structs§

BoundedInstance
CullUniformsGpu
Uniform buffer layout for instance_cull_indirect.wgsl (288 bytes).
DrawIndexedIndirectCommand
WebGPU-standard 20-byte DrawIndexedIndirect command payload.
FrustumPlane
Normalized Gribb-Hartmann frustum plane $\mathbf{n} \cdot \mathbf{x} + d \ge 0$.
GpuInstanceRecord
Stable upload record for mesh instances shared by native and WASM WebGPU paths.
HzbPyramidView
Lightweight zero-heap view over a 2-phase Hierarchical Z-Buffer (HZB) mip chain.
IndirectCullPipelineGpu
GPU-resident compute pipeline and indirect stream buffers for INSTANCE_CULL_INDIRECT_WGSL.
IndirectCullStreamCounts
Output stream counts produced by cull_and_select_lod_indirect_zero_heap.
InstanceCullDescriptor
GPU-aligned per-instance culling & multi-modal routing descriptor (80 bytes, 5 x vec4).

Enums§

RepresentationPolicy
Multi-modal representation policy encoded in InstanceCullDescriptor::rep_policy.
VisibilityListError

Constants§

DEFAULT_LOD_HYSTERESIS
Default fractional hysteresis deadband around LOD thresholds (10%).
DEFAULT_LOD_THRESHOLDS_PX
Default screen-space projected radius thresholds in pixels ([LOD0, LOD1, LOD2]).
DEFAULT_MIN_CULL_RADIUS_PX
Default minimum projected radius in pixels below which an instance is sub-pixel culled.
GPU_INSTANCE_RECORD_ABI_VERSION
Version of the packed native/WASM instance record ABI.
MAX_GPU_MESH_INSTANCES

Functions§

build_hzb_mip_chain_zero_heap
Returns (total_texels_written, mip_slices, mip_count).
compact_visible_packed_records
Byte-oriented, alignment-independent form of compact_visible_records for WASM hosts. Output capacity and every source index are checked before the first byte is written.
compact_visible_records
Copy records in visible-index order into caller-owned upload scratch.
cull_and_select_lod_indirect_zero_heap
Zero-heap CPU/GPU parity execution of 6-plane frustum culling, 2-phase HZB depth-pyramid occlusion culling, 4-tier hybrid LOD selection with hysteresis, and multi-modal stream routing.
extract_frustum_planes
Extracts 6 normalized inward-pointing frustum planes from a column-major view-projection matrix.
select_lod_tier_with_hysteresis
Selects the 4-tier LOD index (0..=3) from an epistemic-weighted screen-space projected radius in pixels, applying a fractional hysteresis deadband around threshold transitions.
select_visible_instances
Append the visible source indices in stable input order.
select_visible_instances_packed
WASM-friendly SoA variant of select_visible_instances. Bounds contain three floats per instance, transforms contain 16 column-major floats per instance, and view-projection contains 16 column-major floats. It performs no allocation and writes stable source indices.
select_visible_mesh_instances
Select visible copies of one retained mesh after applying each per-instance transform and the renderer’s shared actor/model transform. The result contains stable source indices so the caller can compact records without losing semantic identity. Invalid numeric inputs fail open.