GPUComputePassEncoder: setPipeline() method
The setPipeline()
method of the GPUComputePassEncoder
interface sets the GPUComputePipeline
to use for this compute pass.
Syntax
Parameters
-
pipeline
-
The GPUComputePipeline
to use for this compute pass.
Return value
Examples
In our basic compute demo, several commands are recorded via a GPUCommandEncoder
. Most of these commands originate from the GPUComputePassEncoder
created via beginComputePass()
. The setPipeline()
call is used as appropriate to set the pipeline to use for this pass.
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 |
setPipeline |
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