pub trait ComputePass<'pass> {
// Required methods
fn set_pipeline(&mut self, pipeline: &'pass ComputePipelineId);
fn set_bind_group(&mut self, index: u32, bind_group: &'pass BindGroupId);
fn dispatch_workgroups(&mut self, x: u32, y: u32, z: u32);
}Expand description
A trait representing an active compute pass, used for recording dispatch commands.
A ComputePass object is obtained from a CommandEncoder and provides methods
to set the compute pipeline, bind resources, and dispatch workgroups.
The 'pass lifetime ensures that the pass object cannot outlive the CommandEncoder
that created it, and that any resources bound to it also live long enough.
Required Methods§
Sourcefn set_pipeline(&mut self, pipeline: &'pass ComputePipelineId)
fn set_pipeline(&mut self, pipeline: &'pass ComputePipelineId)
Sets the active compute pipeline for subsequent dispatch calls.
§Arguments
pipeline- The compute pipeline to use
Sourcefn set_bind_group(&mut self, index: u32, bind_group: &'pass BindGroupId)
fn set_bind_group(&mut self, index: u32, bind_group: &'pass BindGroupId)
Binds a bind group to a specific binding slot.
§Arguments
index- The bind group index (must match shader @group(N) declarations)bind_group- The bind group to bind
Sourcefn dispatch_workgroups(&mut self, x: u32, y: u32, z: u32)
fn dispatch_workgroups(&mut self, x: u32, y: u32, z: u32)
Dispatches compute workgroups.
The total number of invocations is (x * y * z) * workgroup_size where
workgroup_size is defined in the compute shader with @workgroup_size.
§Arguments
x- Number of workgroups in the X dimensiony- Number of workgroups in the Y dimensionz- Number of workgroups in the Z dimension