software-mansion / software-mansion/TypeGPU
bug: Unary `-` is not supported for `u32` values
Open
Nobody has claimed this yet.
bug
- Dominant language
- TypeScript
- Stars
- 3.2k
- Forks
- 122
- Avg merge
- 3d 5h
- Merged PRs (30d)
- 34
Description
Evidence:
const incrementPipeline = root.createGuardedComputePipeline(() => {
'use gpu';
let value = -d.u32(7.5);
counter.$ = value;
});
Causes:
Possible fixes
- We can automatically wrap
u32values withi32(...)before applying the unary negation operator. - We can enforce that operands of the unary
-cannot be of typeu32
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 createGuardedComputePipeline example and trace d.u32(7.5) through handling of the unary - operator. Determine the intended behavior for u32 operands from the two proposed fixes, then verify that the example no longer produces the reported error and that the chosen behavior is covered by a regression test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- compilers, computer-graphics
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100