home/ atoms/ webgpu-render-pipeline

A GPURenderPipeline bundles shader modules, vertex buffer layout, and render targets into a fixed, reusable draw configuration

A GPURenderPipeline is the most complex WebGPU object: it bundles the vertex shader module + entry point, vertex buffer layouts, the fragment shader module + entry point, target texture formats, primitive topology, and more. It is created once and reused for all draw calls sharing the same configuration. The pipeline also carries a layout describing what bind groups it expects. You can specify layout: 'auto' to infer the layout from the shaders (adequate for single-pipeline apps) or provide an explicit GPUPipelineLayout. Render pipelines cannot be modified after creation.

Examples

const cellPipeline = device.createRenderPipeline({
  label: 'Cell pipeline',
  layout: 'auto',
  vertex: { module: cellShaderModule, entryPoint: 'vertexMain', buffers: [vertexBufferLayout] },
  fragment: { module: cellShaderModule, entryPoint: 'fragmentMain', targets: [{ format: canvasFormat }] },
});

Assessment

Name four properties fixed at pipeline creation that cannot change later. When would you choose an explicit GPUPipelineLayout over layout: 'auto'?

“render pipeline controls _how_ geometry is drawn, including things like which sh”
corpus · your-first-webgpu-app-google-codelab · chunk 7