Core guide

Render targets

Compose renderer-owned offscreen targets back into the canvas.

Live example

See Render targets in action

Render a red layer offscreen, then sample it into the canvas presentation pass.

live rendering loading ticks 0

How it works

Create an explicit-size target, select it on a frame, record commands, switch back to the canvas, and draw the target as a texture. The renderer owns views, leases, and pipelines.

Public types

  • WebGpuRenderTarget
  • RenderTargetOptions
  • RenderFrame.set_target

Minimum viable example

typescript
const target = renderer.create_render_target({ width: 800, height: 450 });
const frame = renderer.begin_frame();
frame.set_target(target);
frame.draw_commands(scene_commands);
frame.set_target();
frame.draw_commands([{ kind: "texture", draw: { texture: target } }]);
target.release();
await frame.submit();

Scope and limitations

Targets use the preferred canvas format. Mipmaps, multisampling, arbitrary formats, and broader shader layouts remain separate capabilities.