fix(breaking): shaderGenerator option should be unstable_shaderGenerator in tgpu.init and tgpu.initFromDevice - #2745
Conversation
Resolution Time Benchmark---
config:
themeVariables:
xyChart:
plotColorPalette: "#E63946, #3B82F6, #059669"
---
xychart
title "Random Branching (🔴 PR | 🔵 main | 🟢 release)"
x-axis "max depth" [1, 2, 3, 4, 5, 6, 7, 8]
y-axis "time (ms)"
line [0.81, 1.65, 3.80, 5.79, 6.06, 10.51, 19.61, 21.71]
line [0.74, 1.68, 3.30, 5.61, 6.90, 10.08, 18.29, 21.28]
line [0.86, 1.67, 3.55, 6.13, 6.66, 10.78, 19.69, 19.77]
---
config:
themeVariables:
xyChart:
plotColorPalette: "#E63946, #3B82F6, #059669"
---
xychart
title "Linear Recursion (🔴 PR | 🔵 main | 🟢 release)"
x-axis "max depth" [1, 2, 3, 4, 5, 6, 7, 8]
y-axis "time (ms)"
line [0.33, 0.44, 0.58, 0.73, 0.99, 1.02, 1.23, 1.33]
line [0.27, 0.42, 0.61, 0.70, 0.96, 1.00, 1.16, 1.29]
line [0.29, 0.48, 0.62, 0.75, 0.97, 1.02, 1.26, 1.43]
---
config:
themeVariables:
xyChart:
plotColorPalette: "#E63946, #3B82F6, #059669"
---
xychart
title "Full Tree (🔴 PR | 🔵 main | 🟢 release)"
x-axis "max depth" [1, 2, 3, 4, 5, 6, 7, 8]
y-axis "time (ms)"
line [0.83, 1.83, 3.40, 5.93, 10.55, 22.30, 47.99, 97.91]
line [0.84, 1.84, 3.52, 5.38, 10.64, 23.39, 47.86, 98.22]
line [0.73, 1.85, 4.00, 5.53, 10.85, 22.98, 50.30, 102.95]
|
2c996e4 to
5e68df2
Compare
|
pkg.pr.new packages benchmark commit |
Bundle size comparison (
|
| 🟢 Decreased | ➖ Unchanged | 🔴 Increased (max 0.01%) | ❔ Unknown |
|---|---|---|---|
| 0 | 301 | 21 | 0 |
import { ... } in PR vs import * as ... in PR (is the library tree-Shakeable?):
| Test | tsdown |
|---|---|
| tgpu_init.ts | 258.91 kB ( |
| tgpu_initFromDevice.ts | 258.40 kB ( |
| tgpu_resolve.ts | 164.59 kB ( |
| tgpu_resolveWithContext.ts | 164.53 kB ( |
| tgpu_bindGroupLayout.ts | 68.97 kB ( |
| tgpu_mutableAccessor.ts | 65.97 kB ( |
| tgpu_accessor.ts | 65.96 kB ( |
| tgpu_privateVar.ts | 65.31 kB ( |
| tgpu_workgroupVar.ts | 65.30 kB ( |
| tgpu_const.ts | 64.55 kB ( |
| tgpu_fn.ts | 38.14 kB ( |
| tgpu_fragmentFn.ts | 38.14 kB ( |
| tgpu_vertexFn.ts | 37.96 kB ( |
| tgpu_computeFn.ts | 37.66 kB ( |
| tgpu_vertexLayout.ts | 26.79 kB ( |
| tgpu_comptime.ts | 14.48 kB ( |
| tgpu_unroll.ts | 1.66 kB ( |
| tgpu_slot.ts | 1.54 kB ( |
| tgpu_lazy.ts | 1.19 kB ( |
If you wish to run a comparison for other, slower bundlers, run the 'Tree-shake test' from the GitHub Actions menu.
There was a problem hiding this comment.
Pull request overview
This PR updates the public initialization options API so that the shader generator hook is explicitly marked unstable by renaming shaderGenerator to unstable_shaderGenerator in tgpu.init and tgpu.initFromDevice.
Changes:
- Rename
InitOptions.shaderGenerator→InitOptions.unstable_shaderGeneratorand wire it throughinit(). - Rename
InitFromDeviceOptions.shaderGenerator→InitFromDeviceOptions.unstable_shaderGeneratorand wire it throughinitFromDevice().
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — a breaking rename of the shaderGenerator option to unstable_shaderGenerator in tgpu.init and tgpu.initFromDevice.
- Renames the public option key in
InitOptionsandInitFromDeviceOptionsto align with the existingunstable_-prefixed experimental options (unstable_names,unstable_logOptions). - Updates destructuring in both entry points to use the new key and passes the value through to
TgpuRootImplunchanged. - Internal
shaderGeneratorproperty names onTgpuRootImpl,ExperimentalTgpuRoot, resolve contexts, pipelines, and the GL package remain correctly untouched.
Kimi K2 (free via Pullfrog for OSS) | 𝕏
57f2b22 to
6ae7b41
Compare
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — since the prior review, the JSDoc @default for unstable_names was corrected from 'random' to 'strict' in init.ts and tgpuResolve.ts, and init() / initFromDevice() now destructure unstable_logOptions and unstable_shaderGenerator with consistent local aliases.
- Fixed the documented default for
InitOptions.unstable_namesinpackages/typegpu/src/core/root/init.tsto match the runtime'strict'default. - Fixed the documented default for
InitFromDeviceOptions.unstable_namesin the same file. - Fixed the documented default for
TgpuResolveOptions.namesinpackages/typegpu/src/core/resolve/tgpuResolve.ts. - Refactored destructuring of
unstable_logOptionsandunstable_shaderGeneratorininit()andinitFromDevice()to use renamed locals (logOptions,shaderGenerator) before passing them toTgpuRootImpl.
Ran pnpm --filter typegpu test:types successfully.
Kimi K2 (free via Pullfrog for OSS) | 𝕏
…u.init and tgpu.initFromDevice
6ae7b41 to
3078b10
Compare

No description provided.