Skip to main content

Module indirect_dispatch

Module indirect_dispatch 

Source
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 the VkDispatchIndirectCommand / 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

Structs§

DispatchIndirectArgs
Layout-stable representation of workgroup dispatch dimensions stored in GPU memory.
IndirectDispatchBuffer
A GPU buffer that holds one or more DispatchIndirectArgs slots for use with wgpu::ComputePass::dispatch_workgroups_indirect.

Functions§

args_for_elements
Build DispatchIndirectArgs for a 1-D dispatch over total elements with the given workgroup_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.