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.92, 1.83, 4.27, 6.32, 7.40, 11.85, 21.65, 23.59]
line [0.96, 1.95, 4.39, 5.84, 7.60, 11.61, 22.36, 23.59]
line [0.88, 1.86, 4.53, 6.82, 7.56, 12.26, 22.05, 24.59]
---
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.51, 0.64, 0.79, 1.10, 1.19, 1.36, 1.51]
line [0.28, 0.46, 0.68, 0.83, 1.08, 1.21, 1.38, 1.54]
line [0.35, 0.53, 0.70, 0.79, 1.14, 1.14, 1.41, 1.57]
---
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.79, 2.09, 4.05, 7.20, 12.10, 26.05, 54.26, 108.72]
line [0.77, 2.09, 3.81, 6.64, 12.05, 25.26, 54.06, 107.66]
line [0.88, 2.13, 3.90, 6.51, 13.00, 25.68, 54.76, 111.12]
|
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 | 260.02 kB ( |
| tgpu_initFromDevice.ts | 259.49 kB ( |
| tgpu_resolve.ts | 165.41 kB ( |
| tgpu_resolveWithContext.ts | 165.35 kB ( |
| tgpu_bindGroupLayout.ts | 69.27 kB ( |
| tgpu_mutableAccessor.ts | 66.27 kB ( |
| tgpu_accessor.ts | 66.26 kB ( |
| tgpu_privateVar.ts | 65.61 kB ( |
| tgpu_workgroupVar.ts | 65.60 kB ( |
| tgpu_const.ts | 64.85 kB ( |
| tgpu_fn.ts | 38.45 kB ( |
| tgpu_fragmentFn.ts | 38.45 kB ( |
| tgpu_vertexFn.ts | 38.27 kB ( |
| tgpu_computeFn.ts | 37.97 kB ( |
| tgpu_vertexLayout.ts | 27.08 kB ( |
| tgpu_comptime.ts | 14.77 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) | 𝕏
184d1fd to
3f6f1bc
Compare
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — since the prior review, the branch was rebased onto recent main and a merge commit brought in base-branch updates. The PR's diff is identical to what was already reviewed and approved.
- Rebased the
unstable_shaderGeneratorrename and JSDoc@defaultfixes onto recentmain(no net-new changes).
<!--
Pullfrog review metadata — for any agent (or human-with-agent) reading this
review. Incorporate the fields below into your understanding of the context
this review was made in. The findings below were written against
3f6f1bc; if new commits have landed on fix/unstable-shader-generator-in-root since this review
was submitted, treat any specific bug, file, or line callout as POTENTIALLY
STALE — re-diff against 3f6f1bc (or trigger a fresh review) and
factor commits past 3f6f1bc into your understanding of the current
state before acting on findings.
- Mode: IncrementalReview (delta against prior pullfrog review)
- Files reviewed: 2
- Commits reviewed: 2
- Base: main (55bec73)
- Head: fix/unstable-shader-generator-in-root (3f6f1bc)
- Reviewed commits:
- Prior pullfrog review: 6ae7b41 (#2745 (review))
- Submitted at: 2026-07-29T00:00:00Z
-->
DeepSeek Pro (free via Pullfrog for OSS) (Kimi K2 not used — the program covers this model; add its provider key to run your pick) | 𝕏
…u.init and tgpu.initFromDevice
3f6f1bc to
6d3badc
Compare

No description provided.