RenderPipeline
Quick answer
RenderPipeline combines compiled Shader stages, a buffer layout and fixed render state into a drawable object. Create it with device.createRenderPipeline({vs, fs, bufferLayout, topology, parameters}); any state change requires a new pipeline. It replaces v8 Program and is usually wrapped by Model.
device. createRenderPipeline ( props ) → RenderPipeline
Key points
- Creation accepts vs, fs, bufferLayout, topology and parameters.
- parameters fixes depth, blend and cull state at pipeline creation.
- Changing topology or blend mode means rebuilding the pipeline.
Example
const vs = device.createShader({
stage: 'vertex',
source: [
'#version 300 es',
'in vec3 positions;',
'void main() {',
' gl_Position = vec4(positions, 1.0);',
'}'
].join('\n')
});
const fs = device.createShader({
stage: 'fragment',
source: [
'#version 300 es',
'precision highp float;',
'out vec4 fragColor;',
'void main() {',
' fragColor = vec4(0.35, 0.80, 0.62, 1.0);',
'}'
].join('\n')
});
const pipeline = device.createRenderPipeline({
vs: vs,
fs: fs,
topology: 'triangle-list',
bufferLayout: [
{ name: 'positions', stepMode: 'vertex', format: 'float32x3' }
],
parameters: {
depthCompare: 'less-equal',
depthWriteEnabled: true
}
});const vertexArray = device.createVertexArray({
shaderLayout: pipeline.shaderLayout,
bufferLayout: pipeline.bufferLayout
});
const slot = vertexArray.getBufferSlot('positions');
if (slot !== null) {
vertexArray.setBuffer(slot, positions);
}
const pass = device.beginRenderPass({ clearColor: [0.05, 0.07, 0.1, 1] });
pass.setPipeline(pipeline);
pass.setVertexArray(vertexArray);
pass.draw({ vertexCount: 3 });
pass.end();
Notes
- Editing parameters after creation is unsupported; recreate the pipeline.
- A bufferLayout that mismatches shader attribute locations fails validation.
English edition written for Atlaslog. Code is taken from the original Chinese page and runs unchanged.
Atlaslog (2026). RenderPipeline. https://www.jingweizhi.com/en/lumagl/api/render-pipeline.html (accessed 2026-11-03).