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.82, 1.64, 3.46, 5.66, 6.99, 10.07, 19.28, 19.84]
line [0.88, 1.65, 3.77, 5.26, 6.66, 10.99, 19.51, 22.93]
line [0.82, 1.88, 3.71, 5.80, 6.76, 11.47, 20.54, 21.89]
---
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.25, 0.50, 0.64, 0.77, 1.06, 1.09, 1.24, 1.44]
line [0.31, 0.49, 0.60, 0.72, 0.94, 1.07, 1.23, 1.42]
line [0.28, 0.53, 0.66, 0.76, 1.04, 1.07, 1.30, 1.37]
---
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.75, 1.91, 3.43, 5.96, 11.23, 22.82, 47.79, 97.11]
line [0.73, 1.92, 3.53, 5.70, 10.56, 21.83, 47.60, 96.30]
line [0.89, 1.75, 3.30, 5.83, 10.89, 22.91, 49.67, 100.58]
|
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) | 𝕏
5e68df2 to
57f2b22
Compare
…u.init and tgpu.initFromDevice
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) | 𝕏

No description provided.