Back to Content

GPUCommandBuffer

files/en-us/web/api/gpucommandbuffer/index.md

latest1.2 KB
Original Source

{{APIRef("WebGPU API")}}{{SecureContext_Header}}{{AvailableInWorkers}}

The GPUCommandBuffer interface of the {{domxref("WebGPU API", "WebGPU API", "", "nocode")}} represents a pre-recorded list of GPU commands that can be submitted to a {{domxref("GPUQueue")}} for execution.

A GPUCommandBuffer is created via the {{domxref("GPUCommandEncoder.finish()")}} method; the GPU commands recorded within are submitted for execution by passing the GPUCommandBuffer into the parameter of a {{domxref("GPUQueue.submit()")}} call.

[!NOTE] Once a GPUCommandBuffer object has been submitted, it cannot be used again.

{{InheritanceDiagram}}

Instance properties

  • {{domxref("GPUCommandBuffer.label", "label")}}
    • : A string providing a label that can be used to identify the object, for example in {{domxref("GPUError")}} messages or console warnings.

Examples

js
// …

const commandBuffer = commandEncoder.finish();
device.queue.submit([commandBuffer]);

[!NOTE] Study the WebGPU samples to find complete examples.

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}

See also