refactor: Migrate @typegpu/* libs to use tsover#2217
Conversation
|
pkg.pr.new packages benchmark commit |
📊 Bundle Size Comparison
👀 Notable resultsStatic test results:No major changes. Dynamic test results:No major changes. 📋 All resultsClick to reveal the results table (344 entries).
If you wish to run a comparison for other, slower bundlers, run the 'Tree-shake test' from the GitHub Actions menu. |
6ca68df to
1534e12
Compare
1534e12 to
b93430c
Compare
There was a problem hiding this comment.
Pull request overview
This pull request migrates the @typegpu/* libraries to use "tsover", which enables writing GPU functions using TypeScript operators instead of explicit function calls. The refactor improves code readability and makes GPU code look more like standard TypeScript.
Changes:
- Converted GPU function calls (std.mul, std.add, std.sub) to TypeScript operators (+, -, *, /)
- Added 'use gpu' directives to GPU functions to enable the new syntax
- Simplified imports by using named exports from the main 'typegpu' module
- Replaced verbose type assertions with non-null assertion operators
- Updated helper functions to use more semantic built-in functions (distance, saturate)
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| packages/typegpu/tests/indent.test.ts | Updated test cases to use operator syntax and verify correct WGSL code generation |
| packages/typegpu/tests/examples/individual/vaporrave.test.ts | Updated quinticInterpolationImpl to quinticInterpolation function name and expression grouping |
| packages/typegpu/tests/examples/individual/smoky-triangle.test.ts | Updated quinticInterpolationImpl to quinticInterpolation function name and expression grouping |
| packages/typegpu/tests/examples/individual/ripple-cube.test.ts | Updated quinticInterpolationImpl to quinticInterpolation function name and expression grouping (2 occurrences) |
| packages/typegpu/tests/examples/individual/perlin-noise.test.ts | Updated quinticInterpolationImpl to quinticInterpolation function name and expression grouping |
| packages/typegpu/tests/examples/individual/jelly-slider.test.ts | Updated to use distance() instead of length() and saturate() instead of clamp(x, 0, 1) |
| packages/typegpu/tests/examples/individual/caustics.test.ts | Updated quinticInterpolationImpl to quinticInterpolation function name and expression grouping |
| packages/typegpu-sdf/src/3d.ts | Migrated sdLine3d and sdCapsule to use operator syntax and distance() function |
| packages/typegpu-sdf/src/2d.ts | Migrated multiple SDF functions to use operator syntax, distance(), and saturate() |
| packages/typegpu-noise/src/utils.ts | Converted quintic functions from tgpu.fn to plain TypeScript functions with operator syntax; critical bug in quinticDerivative implementation |
| packages/typegpu-noise/src/random.ts | Converted random generation functions to use operator syntax and exponentiation operator |
| packages/typegpu-noise/src/perlin-3d/algorithm.ts | Converted to use operator syntax and simplified helper functions |
| packages/typegpu-noise/src/perlin-2d/algorithm.ts | Converted to use operator syntax for all mathematical operations |
| packages/typegpu-noise/src/generator.ts | Converted seed functions to use operator syntax |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
fbc98a6 to
f39c291
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 14 out of 14 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Szymon Szulc <103948576+cieplypolar@users.noreply.github.com>
Co-authored-by: Szymon Szulc <103948576+cieplypolar@users.noreply.github.com>
f39c291 to
a7ef613
Compare
No description provided.