swizzle_assignment
WGSL language feature
Specification: WGSL § swizzle_assignment
Check navigator.gpu?.wgslLanguageFeatures?.has('swizzle_assignment')
before choosing a shader that uses this language feature. It is available automatically
when supported; requires swizzle_assignment; documents the dependency
and rejects the shader on unsupported implementations. This language token is not a
requiredFeatures entry for requestDevice(); any additional
device requirements are described below.
With this language feature, a multi-component swizzle of a vector in writable memory can appear on the left of an assignment or compound assignment, as in color.rgb = lit; or v.xy += offset;. Components that are not named keep their values. The swizzle may reorder components - v.zx = w writes w.x to z - but may not repeat one, so v.xx = w remains an error.
It mainly saves boilerplate in hand-written and generated shaders, and lets code ported from GLSL or HLSL, where swizzled writes have long been legal, translate directly. When pointer_composite_access is also supported, the same form works through pointers: p.xz = vec2(1, 2);.
A swizzle assignment writes the whole vector, not just the named components. If several invocations update different components of the same vector in storage or workgroup memory, they race just as they would with full-vector stores, so keep each vector owned by one invocation or use separate scalars or atomics. Without the extension, assign components one at a time or rebuild the vector with a constructor.
Availability by month
| Month | With feature | Eligible reports | Availability |
|---|---|---|---|
| 2026-08 | 2 | 238 | 0.8% |
| 2026-09 | 21 | 175 | 12.0% |
| 2026-10 | 14 | 22 | 63.6% |
By browser (last 30 days)
| Browser | Availability | n |
|---|---|---|
| chrome | 24.8% | 113 |
| edge | 30.8% | 13 |
| firefox | 0.0% | 12 |
| safari | 0.0% | 14 |
Availability = share of first-party, non-quarantined reports with WebGPU on a hardware
(non-fallback) adapter
whose browser reports this token in navigator.gpu.wgslLanguageFeatures.
This measures language support in the browser, not a GPU hardware capability.
Developer-leaning sample.
Full methodology.