RenderPass
Quick answer
RenderPass is a single pass into a framebuffer or the canvas, created by device.beginRenderPass(props). It carries clear values, viewport and scissor, and exposes setPipeline, setBindings, setVertexArray, draw and end. In v9 every draw call must go through an active pass.
device. beginRenderPass ( props ) → RenderPass
Key points
- clearColor set to false preserves the previous frame contents.
- Call setBindings only after setPipeline has selected a pipeline.
- end() pops the pass state and returns control to the encoder.
Example
const pass = device.beginRenderPass({
framebuffer: fbo, // 省略则画到画布
clearColor: [0.04, 0.06, 0.09, 1],
clearDepth: 1,
parameters: { viewport: [0, 0, 256, 256] }
});
pass.setPipeline(pipeline);
pass.setBindings({ uTexture: texture });
pass.setVertexArray(vertexArray);
pass.draw({ vertexCount: 6, instanceCount: 1 });
pass.end();const pass = device.beginRenderPass({ clearColor: [0.04, 0.06, 0.09, 1] });
model.draw(pass);
pass.end();
Notes
- Drawing without a pipeline or vertex array simply returns false.
- Leaving a pass open corrupts the clear behaviour of the next pass.
English edition written for Atlaslog. Code is taken from the original Chinese page and runs unchanged.
Atlaslog (2026). RenderPass. https://www.jingweizhi.com/en/lumagl/api/render-pass.html (accessed 2026-11-03).