Closed dj2 closed 6 months ago
vec.{x,y,z,w,r,g,b,a} = 1
vec.xy = vec2(1)
vec[0] = 1
vec[-1] = 1
vec[99] = 1
ary[1] = 1
ary[-1] = 1
ary[99] = 1
vec[min(max(1, 2), 1)] = 1
struct.a = 1
struct.a.b.c.d.e.r = 1
*ptr = 1
structA = structB
func().r = 1
write
uniform
storage, read
[ ] Compound assignment with space between the <char> and = fails parse
<char>
=
[ ] Same set of tests as simple assignment
[ ] Validate that e1 is only evaluated once (function call returning vec that increments global?)
e1
[ ] _ += 1 fails (for all compound types)
_ += 1
https://www.w3.org/TR/WGSL/#assignment
I believe these are covered. We can fill individual issues for anything which is missing.
Simple assignment
vec.{x,y,z,w,r,g,b,a} = 1
vec.xy = vec2(1)
fails (no multi-swizzle on lhs)vec[0] = 1
vec[-1] = 1
is not a validation errorvec[99] = 1
is not a validation errorary[1] = 1
ary[-1] = 1
is not a validation errorary[99] = 1
is not a validation errorvec[min(max(1, 2), 1)] = 1
struct.a = 1
struct.a.b.c.d.e.r = 1
*ptr = 1
, write to a de-ref'd pointerstructA = structB
succeedsstructA = structB
validation error when structB has {runtime array, atomic, sampler?} (not constructable things)func().r = 1
where func returns a vec ... ?write
failsuniform
address space failsstorage, read
address space failsPhony assignment
Compound assignment
[ ] Compound assignment with space between the
<char>
and=
fails parse[ ] Same set of tests as simple assignment
[ ] Validate that
e1
is only evaluated once (function call returning vec that increments global?)[ ]
_ += 1
fails (for all compound types)https://www.w3.org/TR/WGSL/#assignment