Open Bug 1822096 Opened 1 year ago Updated 20 hours ago

Support WGSL const-expressions and override-expressions in Naga


(Core :: Graphics: WebGPU, task, P2)






(Reporter: jimb, Assigned: teoxoy)


(Depends on 1 open bug, Blocks 8 open bugs)


To implement v1 of the WebGPU spec, Naga needs to support WGSL const-expressions and override-expressions.

The WGSL spec permits expressions in many places that require a value known at shader module creation time or pipeline creation time. These are limited to "const-expressions", which don't depend on variables, buffer contents, etc, or "override-expressions", which are like const-expressions but can also refer to override constants, whose values are supplied at pipeline creation time.


This is currently known to block the following demos from webgpu-v1-samples particularly with local const variables (upstream Naga issue:

  • deferredRendering
  • imageBlur
  • reversedZ
  • shadowMapping
  • videoUploadingWebCodecs

Upstream for const declarations:
Upsteram for override declarations:

I noticed that some shaders at are failing because of this issue, i.e.,

Duplicate of this bug: 1834097
Blocks: 1852491
Blocks: 1852492
Depends on: 1859999
Blocks: 1886808
Depends on: 1873687

Oh, derp, sorry, wrong bug link! This is the most recent re-vendoring that should unblock overrides. 🙂

Depends on: 1891754
No longer depends on: 1873687
You need to log in before you can comment on or make changes to this bug.