WebGPU: WGSL Swizzle Assignment
- Category
- Graphics
- Type
- New or changed feature
- Status
- Proposed (Chrome Proposed)
- Intent stage
- None
WPT details: WebGPU/WGSL have a conformance test suite (https://github.com/gpuweb/cts) that is regularly pulled into Chromium and part of the testing of Dawn/Tint in Chromium. While the CTS can be embedded in WPT, the WebGPU team opted to keep it separate in Chromium testing to use a customized harness for robustness and performance. https://github.com/gpuweb/cts/issues/4579
Summary
Allows a single assignment statement to update multiple components of a vector in the WebGPU Shading Language (WGSL). Developers can use swizzle syntax on the left-hand side of an assignment rather than reconstruct entire vectors or assign components individually. This reduces boilerplate, improves shader readability, and aligns WGSL with other common shading languages.
Motivation
Allows a single assignment statement to update multiple components of a vector in the WebGPU Shading Language (WGSL) to reduce boilerplate, improve shader readability, and align WGSL with other common shading languages.
Standards & signals
- Specification: https://github.com/gpuweb/gpuweb/pull/5268
- Firefox: No signal — Feedback indicated via WebGPU standardization process.
- Safari: Positive — Specification approval constitutes a positive signal.
- Web developers: Positive — The spec issue requesting this feature is one of the top 10 most thumbs-upped issues in the gpuweb repository.
- Tracking bug: https://issues.chromium.org/433787057
Ecosystem
- Web Platform Tests: https://wpt.fyi/results/?q=webgpu%2FWGSL
- Chrome Platform Showcase: https://chrome-platform-showcase.paulkinlan-ea.deno.net/features
- GenDN reference: https://gendn.paulkinlan-ea.deno.net/features
- chrome.dev demos search: https://www.google.com/search?q=site%3Achrome.dev+WebGPU%3A%20WGSL%20Swizzle%20Assignment
- MDN Web Docs: https://developer.mozilla.org/en-US/search?q=WebGPU%3A%20WGSL%20Swizzle%20Assignment
- Baseline status: https://webstatus.dev/?q=WebGPU%3A%20WGSL%20Swizzle%20Assignment