GPUComputePassEncoder

class wgpu.GPUComputePassEncoder

Bases: GPUCommandsMixin, GPUDebugCommandsMixin, GPUBindingCommandsMixin, GPUObjectBase

Object to records commands for a compute pass.

Create a compute pass encoder using GPUCommandEncoder.begin_compute_pass().

dispatch_workgroups(workgroup_count_x, workgroup_count_y=1, workgroup_count_z=1)

Run the compute shader.

Parameters:
  • x (int) – The number of cycles in index x.

  • y (int) – The number of cycles in index y. Default 1.

  • z (int) – The number of cycles in index z. Default 1.

dispatch_workgroups_indirect(indirect_buffer, indirect_offset)

Like dispatch_workgroups(), but the function arguments are in a buffer.

Parameters:
  • indirect_buffer (GPUBuffer) – The buffer that contains the arguments.

  • indirect_offset (int) – The byte offset at which the arguments are.

end()

Record the end of the compute pass.

set_pipeline(pipeline)

Set the pipeline for this compute pass.

Parameters:

pipeline (GPUComputePipeline) – The pipeline to use.