software-mansion / software-mansion/TypeGPU
fix: Stop overloading `d.location` for vertex `shaderLocation`
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 3.2k
- Forks
- 122
- Avg merge
- 3d 5h
- Merged PRs (30d)
- 34
Description
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
@locationattribute. - In a
vertexLayout, decorating an array element withd.locationsets the pipeline’sshaderLocationattribute.
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing how d.location flows through arrayOf() and vertexLayout, comparing struct or IO member handling with vertex shaderLocation handling. The work is done when decorators are single-purpose, vertexLayout still receives shaderLocation, and arrayOf() no longer needs a special case for @location.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- computer-graphics
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100