wgsl: support swizzle assignment#5268
Conversation
fe9ba88 to
d7c5282
Compare
|
Previews, as seen when this build job started (c55aadf): |
d7c5282 to
c984105
Compare
abeafa1 to
9aa6e7f
Compare
GPU Web WG 2025-07-30 Atlantic-time
|
9aa6e7f to
f17717e
Compare
dneto0
left a comment
There was a problem hiding this comment.
There is an interaction with 15.2.5 Function Scope Variable Value Analysis, where a swizzle view should sometimes be considered a full reference. It would be if the root variable is of vector type, because a swizzle assignment is deemed to be overwriting the entire vector.
|
@dneto0 I gather that, since this is a draft, it's not ready for committee discussion? |
f17717e to
57f69a1
Compare
Add 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 <[email protected]> Commit-Queue: Natalie Chouinard <[email protected]> Reviewed-by: James Price <[email protected]>
That's correct. We're implementing a prototype. We'll come back to committee when we are confident in the spec and tests. Also I haven't addressed Alan's feedback on the spec-writing aspect of it. |
Add 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 <[email protected]> Reviewed-by: dan sinclair <[email protected]>
32ce5fc to
9a0cd0e
Compare
|
The latest patches from today include a fix for the order of evaluation, and includes two worked examples: one for assignment, another for compound assignment. |
|
Attaching rendered HTML |
|
updated index.html |
…zzle View The result is always a reference, not just a memory view.
That makes it consistent with other "Algorithm" blocks.
SwizzleViewWrite is only usable with read_write swizzle views
Also, rename IndexSeq to IndexList
This is in the "swizzle view from swizzle view" table.
This gives it structure parallel to compound assignment via swizzle view, so they are easier to compare. It removes a possibly-confusing reference to using the load rule.
17026de to
c55aadf
Compare
|
For @alan-baker, two substantively reviewable changes:
|
|
ok @jimblandy I have addressed all comments so far. Please mark your comments are "resolved" when you are happy that the changes are satisfactory. I've resolved a few of the more trivial cases. |
Add language extension 'swizzle_assignment'
Example:
var v:vec4u;
v.yz = vec2(1,2);
Issue: #737