v146 · Web APIs · Memory Benefit

Memory Benefit

Why TRANSIENT_ATTACHMENT saves memory bandwidth on tile-based GPUs, which GPU architectures benefit, and when to apply the flag in your WebGPU render pipeline.

GPU architecture comparison

Immediate mode GPU (desktop, discrete)

  • Renders each primitive as it's submitted
  • Render targets stored in VRAM
  • All writes/reads go through VRAM bus
  • TRANSIENT_ATTACHMENT accepted but no bandwidth saving
  • Examples: NVIDIA, AMD discrete GPUs

Tile-based GPU (mobile, Apple Silicon)

  • Divides frame into tiles, renders each tile in fast on-chip RAM
  • Flush tile to main memory only when needed
  • TRANSIENT_ATTACHMENT → tile buffer never flushed to RAM
  • Saves memory bandwidth proportional to texture size
  • Examples: Apple A/M chips, Mali, Adreno, PowerVR

bandwidth saving estimate

Texture Size (1920×1080) Tile-based benefit Immediate GPU benefit
Depth buffer (depth24plus) ~8 MB per frame Eliminated (tile-local) None
MSAA resolve target ~32 MB per frame (4× MSAA) Eliminated if not read back None
Intermediate render target ~8 MB per frame Eliminated if used only within pass None
Colour attachment (final output) ~8 MB per frame Not transient — must be presented Not transient

when to use TRANSIENT_ATTACHMENT

// Use TRANSIENT_ATTACHMENT when ALL of these are true:
// 1. The texture is used only as a render target (not sampled)
// 2. You don't need to read the texture after the render pass
// 3. The store op is 'discard'

// ✓ Depth buffer for a single-pass render
const depth = device.createTexture({
  format: 'depth24plus',
  usage: GPUTextureUsage.RENDER_ATTACHMENT | GPUTextureUsage.TRANSIENT_ATTACHMENT,
  size: [w, h],
});

// ✓ MSAA intermediate buffer (discarded after resolve)
const msaa = device.createTexture({
  format,
  sampleCount: 4,
  usage: GPUTextureUsage.RENDER_ATTACHMENT | GPUTextureUsage.TRANSIENT_ATTACHMENT,
  size: [w, h],
});

// ✗ Colour output read as a texture in the next pass
// — cannot use TRANSIENT_ATTACHMENT
const pingPong = device.createTexture({
  usage: GPUTextureUsage.RENDER_ATTACHMENT | GPUTextureUsage.TEXTURE_BINDING,
  // TRANSIENT_ATTACHMENT incompatible with TEXTURE_BINDING
  size: [w, h],
});

see also

scenario focus

Select a scenario to focus its rendered example and summary.