Skip to main content

MAX_OCC_PAGES

Constant MAX_OCC_PAGES 

Source
pub const MAX_OCC_PAGES: usize = 4;
Expand description

Number of separate storage bindings the concatenated occupancy buffer is split (“paged”) across. A single storage binding may not exceed the device’s max_storage_buffer_binding_size — on strict drivers that’s a hard 128 MiB (lavapipe), which the streaming demo’s occupancy already reaches. Splitting into pages keeps every binding under the limit while preserving a single global word index in the shader (each page is a whole number of chunk slots, so no slot ever straddles a page boundary).

On GPUs with multi-GiB binding limits (NVK, native Vulkan) the whole buffer fits in page 0, the other bindings get a 1-word dummy, and the shader’s page select is a single perfectly- predicted uniform branch → zero hot-loop cost. 4 pages covers 512 MiB of occupancy even on a 128 MiB-per-binding device.