fix: Stop overloading d.location for vertex shaderLocation
In WGSL, decorators like @size or @align can only decorate struct members.
Issue #2754 pointed out that we could pass decorators to arrayOf(), which usually had no effect and was misleading.
PR #2781 partially fixed this by rejecting non-@location decorations on array element types. @location remains allowed as an exception, because it is used with vertexLayout.
Problem
d.location currently means two different things depending on context:
- On a struct / IO member, it maps to the WGSL
@location attribute.
- In a
vertexLayout, decorating an array element with d.location sets the pipeline’s shaderLocation attribute.
Moreover, due to this exception, d.location can always be passed to arrayOf(), which might be misleading.
Proposal
Make decorators single-purpose and find another way to pass shaderLocation to the vertexLayout, so arrayOf() no longer needs a special case for @location.
fix: Stop overloading
d.locationfor vertexshaderLocationIn WGSL, decorators like
@sizeor@aligncan only decorate struct members.Issue #2754 pointed out that we could pass decorators to
arrayOf(), which usually had no effect and was misleading.PR #2781 partially fixed this by rejecting non-
@locationdecorations on array element types.@locationremains allowed as an exception, because it is used withvertexLayout.Problem
d.locationcurrently means two different things depending on context:@locationattribute.vertexLayout, decorating an array element withd.locationsets the pipeline’sshaderLocationattribute.Moreover, due to this exception,
d.locationcan always be passed toarrayOf(), which might be misleading.Proposal
Make decorators single-purpose and find another way to pass
shaderLocationto thevertexLayout, soarrayOf()no longer needs a special case for@location.