-
Notifications
You must be signed in to change notification settings - Fork 363
Open
Labels
wgslWebGPU Shading Language IssuesWebGPU Shading Language Issues
Milestone
Description
From https://twitter.com/FreyaHolmer/status/1255107846129299456
okay I swear to god, the amount of time I spend doing this:
float3( v.xy, 0 )
float3( v.x, 0, v.y )
float4( v, 0 )
float4( v, 1 )
like, if only we had swizzle operators for 0 and 1, imagine if we could just
v.xy0
v.x0y
v.xyz0
v.xyz1
So, the idea is to permit 0 and 1 as elements of a swizzle syntax, where they indicate not positions in the source vector, but rather constants 0 and 1 (of the right scalar type).
At LLVM or SPIR-V level, there's no disadvantage, as a general swizzle to construct a vector use the "shuffle" operation, and in this case the second operand to the shuffle would be a 0-1 vector rather than a dummy (unused) vector.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
wgslWebGPU Shading Language IssuesWebGPU Shading Language Issues