GPUComputePassEncoder: end() method
The end()
method of the GPUComputePassEncoder
interface completes recording of the current compute pass command sequence.
Syntax
Parameters
Return value
Validation
The following criteria must be met when calling end()
, otherwise a GPUValidationError
is generated and the GPUComputePassEncoder
becomes invalid:
Examples
In our basic compute demo, several commands are recorded via a GPUCommandEncoder
. Most of these commands originate from the GPUComputePassEncoder
created via GPUCommandEncoder.beginComputePass()
.
const BUFFER_SIZE = 1000;
const commandEncoder = device.createCommandEncoder();
const passEncoder = commandEncoder.beginComputePass();
passEncoder.setPipeline(computePipeline);
passEncoder.setBindGroup(0, bindGroup);
passEncoder.dispatchWorkgroups(Math.ceil(BUFFER_SIZE / 64));
passEncoder.end();
commandEncoder.copyBufferToBuffer(
output,
0,
stagingBuffer,
0,
BUFFER_SIZE,
);
device.queue.submit([commandEncoder.finish()]);
Specifications
Browser compatibility
|
Desktop |
Mobile |
|
Chrome |
Edge |
Firefox |
Internet Explorer |
Opera |
Safari |
WebView Android |
Chrome Android |
Firefox for Android |
Opera Android |
Safari on IOS |
Samsung Internet |
end |
113Currently supported on ChromeOS, macOS, and Windows only.
|
113Currently supported on ChromeOS, macOS, and Windows only.
|
previewCurrently supported on Linux and Windows only.
|
No |
99Currently supported on ChromeOS, macOS, and Windows only.
|
No |
No |
No |
No |
No |
No |
No |
See also