Skip to content

fix(breaking): shaderGenerator option should be unstable_shaderGenerator in tgpu.init and tgpu.initFromDevice#2745

Open
iwoplaza wants to merge 1 commit into
mainfrom
fix/unstable-shader-generator-in-root
Open

fix(breaking): shaderGenerator option should be unstable_shaderGenerator in tgpu.init and tgpu.initFromDevice#2745
iwoplaza wants to merge 1 commit into
mainfrom
fix/unstable-shader-generator-in-root

Conversation

@iwoplaza

Copy link
Copy Markdown
Collaborator

No description provided.

@github-actions

github-actions Bot commented Jul 20, 2026

Copy link
Copy Markdown

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]
Loading
---
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]
Loading
---
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]
Loading

@iwoplaza iwoplaza changed the title fix: shaderGenerator option should be unstable_shaderGenerator in tgpu.init and tgpu.initFromDevice fix(breaking): shaderGenerator option should be unstable_shaderGenerator in tgpu.init and tgpu.initFromDevice Jul 20, 2026
@iwoplaza
iwoplaza force-pushed the fix/unstable-shader-generator-in-root branch from 2c996e4 to 5e68df2 Compare July 20, 2026 10:19
@github-actions

github-actions Bot commented Jul 20, 2026

Copy link
Copy Markdown

pkg.pr.new

packages
Ready to be installed by your favorite package manager ⬇️

https://pkg.pr.new/software-mansion/TypeGPU/eslint-plugin-typegpu@6ae7b418270c4ca6dda9cea12e457b07178b7743
https://pkg.pr.new/software-mansion/TypeGPU/tgpu-gen@6ae7b418270c4ca6dda9cea12e457b07178b7743
https://pkg.pr.new/software-mansion/TypeGPU/tinyest-for-wgsl@6ae7b418270c4ca6dda9cea12e457b07178b7743
https://pkg.pr.new/software-mansion/TypeGPU/typegpu@6ae7b418270c4ca6dda9cea12e457b07178b7743
https://pkg.pr.new/software-mansion/TypeGPU/@typegpu/cli@6ae7b418270c4ca6dda9cea12e457b07178b7743
https://pkg.pr.new/software-mansion/TypeGPU/@typegpu/color@6ae7b418270c4ca6dda9cea12e457b07178b7743
https://pkg.pr.new/software-mansion/TypeGPU/@typegpu/gl@6ae7b418270c4ca6dda9cea12e457b07178b7743
https://pkg.pr.new/software-mansion/TypeGPU/@typegpu/noise@6ae7b418270c4ca6dda9cea12e457b07178b7743
https://pkg.pr.new/software-mansion/TypeGPU/@typegpu/radiance-cascades@6ae7b418270c4ca6dda9cea12e457b07178b7743
https://pkg.pr.new/software-mansion/TypeGPU/@typegpu/react@6ae7b418270c4ca6dda9cea12e457b07178b7743
https://pkg.pr.new/software-mansion/TypeGPU/@typegpu/sdf@6ae7b418270c4ca6dda9cea12e457b07178b7743
https://pkg.pr.new/software-mansion/TypeGPU/@typegpu/three@6ae7b418270c4ca6dda9cea12e457b07178b7743
https://pkg.pr.new/software-mansion/TypeGPU/unplugin-typegpu@6ae7b418270c4ca6dda9cea12e457b07178b7743

benchmark
view benchmark

commit
view commit

@iwoplaza
iwoplaza marked this pull request as ready for review July 20, 2026 10:22
Copilot AI review requested due to automatic review settings July 20, 2026 10:22
@github-actions

Copy link
Copy Markdown

Bundle size comparison (import * as ... in PR vs import * as ... in target):

🟢 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 ($${\color{green}-3.2\%}$$)
tgpu_initFromDevice.ts 258.40 kB ($${\color{green}-3.4\%}$$)
tgpu_resolve.ts 164.59 kB ($${\color{green}-38.5\%}$$)
tgpu_resolveWithContext.ts 164.53 kB ($${\color{green}-38.5\%}$$)
tgpu_bindGroupLayout.ts 68.97 kB ($${\color{green}-74.2\%}$$)
tgpu_mutableAccessor.ts 65.97 kB ($${\color{green}-75.3\%}$$)
tgpu_accessor.ts 65.96 kB ($${\color{green}-75.3\%}$$)
tgpu_privateVar.ts 65.31 kB ($${\color{green}-75.6\%}$$)
tgpu_workgroupVar.ts 65.30 kB ($${\color{green}-75.6\%}$$)
tgpu_const.ts 64.55 kB ($${\color{green}-75.9\%}$$)
tgpu_fn.ts 38.14 kB ($${\color{green}-85.7\%}$$)
tgpu_fragmentFn.ts 38.14 kB ($${\color{green}-85.7\%}$$)
tgpu_vertexFn.ts 37.96 kB ($${\color{green}-85.8\%}$$)
tgpu_computeFn.ts 37.66 kB ($${\color{green}-85.9\%}$$)
tgpu_vertexLayout.ts 26.79 kB ($${\color{green}-90.0\%}$$)
tgpu_comptime.ts 14.48 kB ($${\color{green}-94.6\%}$$)
tgpu_unroll.ts 1.66 kB ($${\color{green}-99.4\%}$$)
tgpu_slot.ts 1.54 kB ($${\color{green}-99.4\%}$$)
tgpu_lazy.ts 1.19 kB ($${\color{green}-99.6\%}$$)

If you wish to run a comparison for other, slower bundlers, run the 'Tree-shake test' from the GitHub Actions menu.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.shaderGeneratorInitOptions.unstable_shaderGenerator and wire it through init().
  • Rename InitFromDeviceOptions.shaderGeneratorInitFromDeviceOptions.unstable_shaderGenerator and wire it through initFromDevice().

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/typegpu/src/core/root/init.ts
Comment thread packages/typegpu/src/core/root/init.ts

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ 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 InitOptions and InitFromDeviceOptions to align with the existing unstable_-prefixed experimental options (unstable_names, unstable_logOptions).
  • Updates destructuring in both entry points to use the new key and passes the value through to TgpuRootImpl unchanged.
  • Internal shaderGenerator property names on TgpuRootImpl, ExperimentalTgpuRoot, resolve contexts, pipelines, and the GL package remain correctly untouched.

Pullfrog  | View workflow run | Using Kimi K2 (free via Pullfrog for OSS) | 𝕏

@iwoplaza
iwoplaza force-pushed the fix/unstable-shader-generator-in-root branch from 5e68df2 to 57f2b22 Compare July 21, 2026 14:24
@iwoplaza
iwoplaza force-pushed the fix/unstable-shader-generator-in-root branch from 57f2b22 to 6ae7b41 Compare July 21, 2026 14:24

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ 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_names in packages/typegpu/src/core/root/init.ts to match the runtime 'strict' default.
  • Fixed the documented default for InitFromDeviceOptions.unstable_names in the same file.
  • Fixed the documented default for TgpuResolveOptions.names in packages/typegpu/src/core/resolve/tgpuResolve.ts.
  • Refactored destructuring of unstable_logOptions and unstable_shaderGenerator in init() and initFromDevice() to use renamed locals (logOptions, shaderGenerator) before passing them to TgpuRootImpl.

Ran pnpm --filter typegpu test:types successfully.

Pullfrog  | View workflow run | Using Kimi K2 (free via Pullfrog for OSS) | 𝕏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants