Atlaslog
Atlaslog / luma.gl / API reference / ComputePass
luma.gl · API reference

ComputePass

Quick answer

ComputePass records compute dispatches against one ComputePipeline. Create it with device.beginComputePass, call setPipeline then setBindings, dispatch workgroup counts with dispatchWorkgroups(x, y, z), and finish with end(). It requires the WebGPU backend and cannot run on WebGL, and dispatch sizes derive from the workgroup size declared in the shader.

Last verified 2026-11-03 · luma.gl 9.4 · Cite this page
device. beginComputePass ( props ?) → ComputePass
Key points
Example
const COUNT = 65536;
const WORKGROUP_SIZE = 64;

const pass = device.beginComputePass();

pass.setPipeline(pipeline);
pass.dispatch(Math.ceil(COUNT / WORKGROUP_SIZE));
pass.end();

device.submit();
/* 缓冲区里依次是 x、y、z 三个 u32 工作组数量 */
const args = device.createBuffer({
  data: new Uint32Array([1024, 1, 1])
});

const pass = device.beginComputePass();
pass.setPipeline(pipeline);
pass.dispatchIndirect(args, 0);
pass.end();
device.submit();
Notes
Runnable examplesChinese originalAll API references
English edition written for Atlaslog. Code is taken from the original Chinese page and runs unchanged.
Cite this page

Atlaslog (2026). ComputePass. https://www.jingweizhi.com/en/lumagl/api/compute-pass.html (accessed 2026-11-03).