← Back to release summary

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

Ecosystem

View on chromestatus.com