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

CommandBuffer

Quick answer

CommandBuffer is the immutable product of CommandEncoder.finish, holding recorded render passes, compute passes and copy commands. Submit it once through the device queue, after which it is consumed. Keep references mainly for debugging, timing and inspecting the recorded command stream.

Last verified 2026-11-03 · luma.gl 9.4 · Cite this page
encoder. finish () → CommandBuffer
Key points
Example
const encoder = device.createCommandEncoder({ id: 'gbuffer' });

const pass = encoder.beginRenderPass({
  framebuffer: fbo,
  clearColor: [0, 0, 0, 1]
});
pass.setPipeline(pipeline);
pass.setVertexArray(vertexArray);
pass.draw({ vertexCount: 36 });
pass.end();

const commandBuffer = encoder.finish();

device.submit(commandBuffer);
const encoder = device.createCommandEncoder({
  id: 'frame-' + frameIndex,
  userData: { pass: 'terrain', frame: frameIndex }
});

/* ……录制…… */

const cb = encoder.finish();
device.submit(cb);
cb.destroy();
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). CommandBuffer. https://www.jingweizhi.com/en/lumagl/api/command-buffer.html (accessed 2026-11-03).