For AI agents: a documentation index is available at /llms.txt. Markdown versions of all pages are available by appending .md to any URL.

Interface GPUComputePassEncoder

The GPUComputePassEncoder interface of the WebGPU API encodes commands related to controlling the compute shader stage, as issued by a GPUComputePipeline. It forms part of the overall encoding activity of a GPUCommandEncoder. Available only in secure contexts.

MDN Reference

interface GPUComputePassEncoder {
    label: string;
    dispatchWorkgroups(
        workgroupCountX: number,
        workgroupCountY?: number,
        workgroupCountZ?: number,
    ): void;
    dispatchWorkgroupsIndirect(
        indirectBuffer: GPUBuffer,
        indirectOffset: number,
    ): void;
    end(): void;
    insertDebugMarker(markerLabel: string): void;
    popDebugGroup(): void;
    pushDebugGroup(groupLabel: string): void;
    setBindGroup(
        index: number,
        bindGroup: GPUBindGroup | null,
        dynamicOffsets?: number[],
    ): void;
    setBindGroup(
        index: number,
        bindGroup: GPUBindGroup | null,
        dynamicOffsetsData: Uint32Array<ArrayBufferLike>,
        dynamicOffsetsDataStart: number,
        dynamicOffsetsDataLength: number,
    ): void;
    setBindGroup(
        index: number,
        bindGroup: GPUBindGroup | null,
        dynamicOffsets?: Iterable<number, any, any>,
    ): void;
    setPipeline(pipeline: GPUComputePipeline): void;
}

Hierarchy (View Summary)

Index
label: string
  • The dispatchWorkgroups() method of the GPUComputePassEncoder interface dispatches a specific grid of workgroups to perform the work being done by the current GPUComputePipeline (i.e., set via GPUComputePassEncoder.setPipeline()).

    MDN Reference

    Parameters

    • workgroupCountX: number
    • OptionalworkgroupCountY: number
    • OptionalworkgroupCountZ: number

    Returns void

  • The dispatchWorkgroupsIndirect() method of the GPUComputePassEncoder interface dispatches a grid of workgroups, defined by the parameters of a GPUBuffer, to perform the work being done by the current GPUComputePipeline (i.e., set via GPUComputePassEncoder.setPipeline()).

    MDN Reference

    Parameters

    • indirectBuffer: GPUBuffer
    • indirectOffset: number

    Returns void

  • The end() method of the GPUComputePassEncoder interface completes recording of the current compute pass command sequence.

    MDN Reference

    Returns void

Was this helpful?