GPUCommandEncoder: finish() method
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.
Note: This feature is available in Web Workers.
The finish() method of the
GPUCommandEncoder interface completes recording of the command sequence encoded on this GPUCommandEncoder, returning a corresponding GPUCommandBuffer.
Syntax
finish()
finish(descriptor)
Parameters
descriptorOptional-
An object that can contain the following properties:
labelOptional-
A string providing a label for the returned
GPUCommandBufferthat can be used to identify it, for example inGPUErrormessages or console warnings.
Return value
A GPUCommandBuffer object instance.
Validation
The following criteria must be met when calling finish(), otherwise a GPUValidationError is generated and the GPUCommandEncoder becomes invalid:
- There are no active debug groups (i.e., started via
pushDebugGroup()). - The
GPUCommandEncoderis in an open state — this means that:- There are no child
GPUComputePassEncoderorGPURenderPassEncoders active that have not been ended (by callingend()). - The
GPUCommandEncoderhas not already hadfinish()called on it (in which case it cannot be used to encode any more commands).
- There are no child
Examples
// …
const commandBuffer = commandEncoder.finish();
device.queue.submit([commandBuffer]);
// …
Specifications
| Specification |
|---|
| WebGPU> # dom-gpucommandencoder-finish> |
Browser compatibility
Loading…
See also
- The WebGPU API