Expand description
Indirect compute dispatch support for GPU-driven workloads.
Indirect dispatch allows the workgroup counts for a compute shader to be stored in a GPU-side buffer (written by a preceding GPU pass), eliminating the need for a CPU readback round-trip before issuing the next dispatch.
§Key types
DispatchIndirectArgs— layout-stable, 12-byte struct that maps directly onto theVkDispatchIndirectCommand/ D3D12 / Metal equivalent.IndirectDispatchBuffer— a GPU buffer holding one or more dispatch argument slots, initialised from the CPU and updateable at any time.
§Helper functions
workgroup_count_1d/workgroup_count_2d/workgroup_count_3d— compute the ceiling-division workgroup counts for common dispatch dimensions without requiring a GPU context.args_for_elements— short-hand for building a 1-D dispatch args struct.dispatch_indirect_on_pass— convenience wrapper that sets the pipeline, bind groups, and issues the indirect dispatch in one call.
Structs§
- Dispatch
Indirect Args - Layout-stable representation of workgroup dispatch dimensions stored in GPU memory.
- Indirect
Dispatch Buffer - A GPU buffer that holds one or more
DispatchIndirectArgsslots for use withwgpu::ComputePass::dispatch_workgroups_indirect.
Functions§
- args_
for_ elements - Build
DispatchIndirectArgsfor a 1-D dispatch overtotalelements with the givenworkgroup_size. - dispatch_
indirect_ on_ pass - Set the pipeline, bind groups, and issue an indirect dispatch in one call.
- workgroup_
count_ 1d - Compute the ceiling-division workgroup count for a 1-D dispatch.
- workgroup_
count_ 2d - Compute the ceiling-division workgroup counts for a 2-D dispatch.
- workgroup_
count_ 3d - Compute the ceiling-division workgroup counts for a 3-D dispatch.