feat: unary operator ! support and std.not#2346
Open
cieplypolar wants to merge 9 commits intomainfrom
Open
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes:
std.notDifferences between them:
