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 GPUCommandEncoder

The GPUCommandEncoder interface of the WebGPU API represents an encoder that collects a sequence of GPU commands to be issued to the GPU. Available only in secure contexts.

MDN Reference

interface GPUCommandEncoder {
    label: string;
    beginComputePass(
        descriptor?: GPUComputePassDescriptor,
    ): GPUComputePassEncoder;
    beginRenderPass(descriptor: GPURenderPassDescriptor): GPURenderPassEncoder;
    clearBuffer(buffer: GPUBuffer, offset?: number, size?: number): void;
    copyBufferToBuffer(
        source: GPUBuffer,
        destination: GPUBuffer,
        size?: number,
    ): void;
    copyBufferToBuffer(
        source: GPUBuffer,
        sourceOffset: number,
        destination: GPUBuffer,
        destinationOffset: number,
        size?: number,
    ): void;
    copyBufferToTexture(
        source: GPUTexelCopyBufferInfo,
        destination: GPUTexelCopyTextureInfo,
        copySize: GPUExtent3D,
    ): void;
    copyBufferToTexture(
        source: GPUTexelCopyBufferInfo,
        destination: GPUTexelCopyTextureInfo,
        copySize: Iterable<number>,
    ): void;
    copyTextureToBuffer(
        source: GPUTexelCopyTextureInfo,
        destination: GPUTexelCopyBufferInfo,
        copySize: GPUExtent3D,
    ): void;
    copyTextureToBuffer(
        source: GPUTexelCopyTextureInfo,
        destination: GPUTexelCopyBufferInfo,
        copySize: Iterable<number>,
    ): void;
    copyTextureToTexture(
        source: GPUTexelCopyTextureInfo,
        destination: GPUTexelCopyTextureInfo,
        copySize: GPUExtent3D,
    ): void;
    copyTextureToTexture(
        source: GPUTexelCopyTextureInfo,
        destination: GPUTexelCopyTextureInfo,
        copySize: Iterable<number>,
    ): void;
    finish(descriptor?: GPUCommandBufferDescriptor): GPUCommandBuffer;
    insertDebugMarker(markerLabel: string): void;
    popDebugGroup(): void;
    pushDebugGroup(groupLabel: string): void;
    resolveQuerySet(
        querySet: GPUQuerySet,
        firstQuery: number,
        queryCount: number,
        destination: GPUBuffer,
        destinationOffset: number,
    ): void;
}

Hierarchy (View Summary)

Index
label: string
  • The clearBuffer() method of the GPUCommandEncoder interface encodes a command that fills a region of a GPUBuffer with zeroes.

    MDN Reference

    Parameters

    • buffer: GPUBuffer
    • Optionaloffset: number
    • Optionalsize: number

    Returns void

  • The copyBufferToBuffer() method of the GPUCommandEncoder interface encodes a command that copies data from one GPUBuffer to another.

    MDN Reference

    Parameters

    Returns void

  • Parameters

    • source: GPUBuffer
    • sourceOffset: number
    • destination: GPUBuffer
    • destinationOffset: number
    • Optionalsize: number

    Returns void

  • The resolveQuerySet() method of the GPUCommandEncoder interface encodes a command that resolves a GPUQuerySet, copying the results into a specified GPUBuffer.

    MDN Reference

    Parameters

    • querySet: GPUQuerySet
    • firstQuery: number
    • queryCount: number
    • destination: GPUBuffer
    • destinationOffset: number

    Returns void

Was this helpful?