Skip to main content

dynamic_buffer_binding

Function dynamic_buffer_binding 

Source
pub fn dynamic_buffer_binding(
    buffer: &Buffer,
    element_size: u64,
) -> BindingResource<'_>
Expand description

Builds the bind group entry resource for a dynamically-offset binding. Unlike buffer.as_entire_binding(), this scopes the entry to a single element_size-sized element starting at offset 0 in the buffer — required because the dynamic offset passed to set_bind_group at draw/dispatch time is added on top of this base range, and wgpu validates offset + size <= buffer size. Binding the whole buffer here would make any nonzero dynamic offset fail validation.