Feature
Investigate Immediates (a.k.a. push/root constants), shipped in Chrome 149/150.
Immediates let you pass small, frequently-changing data directly to a shader without creating a GPU buffer or bind group. The values are injected straight into the pass encoder, avoiding a memory write and a bind-group lookup per update.
API surface:
- WGSL — declare via the
immediate address space:
var<immediate> color: vec4f;
- JS — set before a draw call:
passEncoder.setImmediates(/*rangeOffset=*/0, new Float32Array([1, 0, 0, 1]));
passEncoder.draw(3);
- Pipeline layout —
layout: 'auto' infers immediateSize from the WGSL module; explicit layouts declare it.
- Capability detection —
navigator.gpu.wgslLanguageFeatures.has('immediate_address_space').
Benefit
Notes
- Chrome 149/150 only at the moment; WebGPU-only with no WebGL2 equivalent, so it requires capability detection and a graceful fallback to uniform buffers.
- Strictly for small values — large arrays, complex lighting structures, and big matrices should stay in uniform/storage buffers (push-constant size budget is small).
- Requires plumbing the
immediate address space through shader generation and the WebGPU pipeline-layout/draw path.
- Ref: https://developer.chrome.com/blog/new-in-webgpu-149-150#immediates
Feature
Investigate Immediates (a.k.a. push/root constants), shipped in Chrome 149/150.
Immediates let you pass small, frequently-changing data directly to a shader without creating a GPU buffer or bind group. The values are injected straight into the pass encoder, avoiding a memory write and a bind-group lookup per update.
API surface:
immediateaddress space:layout: 'auto'infersimmediateSizefrom the WGSL module; explicit layouts declare it.navigator.gpu.wgslLanguageFeatures.has('immediate_address_space').Benefit
Notes
immediateaddress space through shader generation and the WebGPU pipeline-layout/draw path.