playcanvas / playcanvas/engine

Investigate support for WebGPU Immediates (push constants)

Open
#8,917 0 comments 2 reactions 1 assignee View on GitHub

@mvaligursky is already working on this.

Since Jun 17, 2026.

area: graphics enhancement
Dominant language
JavaScript
Stars
16.8k
Forks
2k
Avg merge
4h 32m
Merged PRs (30d)
222

Description

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 layoutlayout: 'auto' infers immediateSize from the WGSL module; explicit layouts declare it.
  • Capability detectionnavigator.gpu.wgslLanguageFeatures.has('immediate_address_space').
Benefit
  • Reduce CPU overhead for per-draw data that changes every draw call (object IDs, small per-draw transforms/params) by skipping uniform-buffer writes and bind-group rebinds.
  • A potential fast path for the kind of redundant state churn discussed in #7656 / #7880, where WebGPU's per-draw binding cost lags WebGL2.
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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.