software-mansion / software-mansion/TypeGPU
[RFC] fix: disallow calls on LHS of assignments
Open
Nobody has claimed this yet.
bug
- Dominant language
- TypeScript
- Stars
- 3.2k
- Forks
- 122
- Avg merge
- 3d 5h
- Merged PRs (30d)
- 34
Description
it('disallows calls on lhs', () => {
const getVec = () => {
'use gpu';
return d.vec2u(1, 2);
};
const fn = () => {
'use gpu';
getVec().x = 1;
};
expect(tgpu.resolve([fn])).toMatchInlineSnapshot(`
"fn getVec() -> vec2u {
return vec2u(1, 2);
}
fn fn_1() {
getVec().x = 1u;
}"
`);
});
This is an invalid WGSL. However, I see no way on how this could potentially be useful, so is there really a need handle this?
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 with the inline test using tgpu.resolve and inspect how the shown TypeScript assignment is converted into WGSL. Determine the intended handling for calls on the left-hand side, then update the regression coverage so the generated result no longer permits invalid WGSL.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- computer-graphics
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100