wgsl: support swizzle assignment by dneto0 · Pull Request #5268 · gpuweb/gpuweb
copybara-service bot pushed a commit to google/dawn that referenced this pull request
Jan 22, 2026Add a new core type called Swizzle View that is used as the type of swizzle expressions in the resolver. This change is based on the draft spec in: gpuweb/gpuweb#5268 Currently, there should be no functional change, it simply changes the sem node types, which are then lowered in ProgramToIR to the expected vector types. However, this change supports a future implementation of swizzle assignment, where it will be necessary for swizzled objects to be treated as memory views rather than concrete values. Bug: 473857629 Change-Id: I34342f921e6906b599f840c10dbb455eed37cb94 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/285675 Reviewed-by: dan sinclair <dsinclair@chromium.org> Commit-Queue: Natalie Chouinard <chouinard@google.com> Reviewed-by: James Price <jrprice@google.com>
jimblandy
moved this from Future agenda
to Awaiting investigation / implementation
in WGSL
copybara-service bot pushed a commit to google/dawn that referenced this pull request
Feb 19, 2026Add WGSL language support for swizzle assignment on vectors as a proof of concept. This implementation is based on the draft spec and passes all CTS tests. It is enabled behind the swizzle_assignment language feature flag as an unsafe experimental feature. Draft Spec: gpuweb/gpuweb#5268 Bug: 473857629 Change-Id: Ic111554c53e41a9f3305f3118258f7dd5df4a29d Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/290357 Commit-Queue: Natalie Chouinard <chouinard@google.com> Reviewed-by: dan sinclair <dsinclair@chromium.org>
Add language extension 'swizzle_assignment' Example: var v:vec4u; v.yz = vec2(1,2); Now includes fixes on the order of evaluation. Issue: gpuweb#737
When using a single-letter swizzle name on a pointer or reference, the result is a reference to a component. This can be used anywhere a reference-to-component can be used!
For reference, it's still twice. For swizzle view, it's three times. h/t @sudonatalie
split the tables between the case where the inner expression is a vector vs. a memory view of a vector.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters