feat: unary operator ! support and std.not#2346
Conversation
|
pkg.pr.new packages benchmark commit |
📊 Bundle Size Comparison
👀 Notable resultsStatic test results:No major changes. Dynamic test results:
📋 All resultsClick to reveal the results table (349 entries).
If you wish to run a comparison for other, slower bundlers, run the 'Tree-shake test' from the GitHub Actions menu. |
! support and std.not
There was a problem hiding this comment.
Pull request overview
Adds support for the TGSL unary ! operator during WGSL generation and introduces/extends std.not to cover vector boolean negation and numeric→boolean conversions, with accompanying tests and snapshot updates.
Changes:
- Implement TGSL unary
!codegen with compile-time folding plus runtime numeric/boolean handling. - Add/extend
std.notto support scalars and vectors (including numeric vectors) with correct WGSL emission. - Expand test coverage and update docs example snapshots affected by the new negation behavior.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/typegpu/tests/tgsl/wgslGenerator.test.ts | Adds integration tests for unary ! across comptime/runtime cases and error/warn behavior. |
| packages/typegpu/tests/std/boolean/not.test.ts | Expands std.not unit + codegen tests for scalars/vectors and error cases. |
| packages/typegpu/src/tgsl/wgslGenerator.ts | Adds unary ! operator support in the generator with runtime type handling and diagnostics. |
| packages/typegpu/src/std/boolean.ts | Redefines std.not signature/codegen and CPU implementation to support scalar + vector negation. |
| packages/typegpu/src/data/wgslTypes.ts | Adds an isBool schema guard used by std.not codegen. |
| apps/typegpu-docs/tests/individual-example-tests/tgsl-parsing-test.test.ts | Updates snapshot output impacted by negation constant-folding and new behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
iwoplaza
left a comment
There was a problem hiding this comment.
Awesome push forward! 💜🙏
Changes:
std.notDifferences between them:
