feat: Stabilize pipelines and entry functions#2168
Conversation
📊 Bundle Size Comparison
👀 Notable resultsStatic test results:No major changes. Dynamic test results:
📋 All resultsClick to reveal the results table (340 entries).
If you wish to run a comparison for other, slower bundlers, run the 'Tree-shake test' from the GitHub Actions menu. |
9c37964 to
bd6bb91
Compare
|
pkg.pr.new packages benchmark commit |
d11bb7b to
ac67647
Compare
There was a problem hiding this comment.
Pull request overview
This PR stabilizes TypeGPU’s entry function and pipeline APIs by promoting several previously-unstable functions/methods to the stable surface (tgpu.* and root.*), while keeping the old ['~unstable'] access paths available via deprecations. It updates tests, docs, and examples across the monorepo to use the stabilized APIs.
Changes:
- Export
tgpu.computeFn,tgpu.vertexFn, andtgpu.fragmentFnfrom the stable barrel, and deprecate the correspondingtgpu['~unstable'].*re-exports. - Adjust
TgpuRoot/~unstabletyping to reflect stabilized pipeline entry points, and add deprecated typings for legacy chaining APIs. - Migrate tests, docs, and example code from
['~unstable']usage to stable APIs (root.create*Pipeline,tgpu.*Fn,tgpu.comptime, etc.).
Reviewed changes
Copilot reviewed 121 out of 121 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| packages/unplugin-typegpu/test/auto-naming.test.ts | Updates plugin snapshots/tests to stable tgpu.*Fn and stable guarded pipeline creation. |
| packages/typegpu/tests/unplugin/autoname.test.ts | Updates autonaming tests to stable entry fns and stable pipeline creation. |
| packages/typegpu/tests/tgslFn.test.ts | Migrates TGSL entry-fn resolution tests to stable tgpu.*Fn. |
| packages/typegpu/tests/tgsl/wgslGenerator.test.ts | Uses stable tgpu.comptime. |
| packages/typegpu/tests/tgsl/ternaryOperator.test.ts | Uses stable tgpu.comptime. |
| packages/typegpu/tests/tgsl/consoleLog.test.ts | Migrates entry fns and compute pipeline creation to stable APIs. |
| packages/typegpu/tests/tgpuGenericFn.test.ts | Uses stable tgpu.accessor and stable guarded compute pipeline creation. |
| packages/typegpu/tests/texture.test.ts | Uses stable entry fns and stable render-pipeline construction chaining. |
| packages/typegpu/tests/root.test.ts | Uses stable tgpu.vertexFn / tgpu.fragmentFn. |
| packages/typegpu/tests/resolve.test.ts | Uses stable tgpu.fragmentFn. |
| packages/typegpu/tests/renderPipeline.test.ts | Migrates entry-fn shells and render pipeline creation to stable APIs. |
| packages/typegpu/tests/rawFn.test.ts | Uses stable tgpu.*Fn shells, including raw WGSL compute shell. |
| packages/typegpu/tests/pipeline-resolution.test.ts | Uses stable entry-fn shells. |
| packages/typegpu/tests/indent.test.ts | Uses stable tgpu.vertexFn. |
| packages/typegpu/tests/functionTagged.test.ts | Uses stable tgpu.*Fn shells for tagged syntax tests. |
| packages/typegpu/tests/function.test.ts | Uses stable tgpu.computeFn / tgpu.vertexFn / tgpu.fragmentFn. |
| packages/typegpu/tests/entryFnHeaderGen.test.ts | Uses stable tgpu.*Fn shells. |
| packages/typegpu/tests/entryFnBuiltinArgs.test.ts | Uses stable entry-fn shells for builtin validation/type tests. |
| packages/typegpu/tests/computePipeline.test.ts | Uses stable tgpu.computeFn and stable compute pipeline creation. |
| packages/typegpu/src/tgpuUnstable.ts | Adds deprecation annotations for newly-stable exports. |
| packages/typegpu/src/tgpu.ts | Exports computeFn, vertexFn, fragmentFn from the stable barrel. |
| packages/typegpu/src/core/root/rootTypes.ts | Updates root typings: TgpuRoot extends pipeline-building surface, narrows ~unstable surface, adds deprecated overloads. |
| packages/typegpu/src/core/root/init.ts | Updates ~unstable property typing on the runtime root implementation. |
| packages/typegpu/src/common/fullScreenTriangle.ts | Updates doc example to use common.fullScreenTriangle and root.createRenderPipeline. |
| packages/typegpu/README.md | Updates README usage to stable root.createGuardedComputePipeline. |
| packages/typegpu-sdf/README.md | Updates README to stable tgpu.fragmentFn. |
| packages/typegpu-noise/src/perlin-3d/static-cache.ts | Updates docs and pipeline creation to stable guarded compute pipeline API. |
| packages/typegpu-noise/src/perlin-3d/dynamic-cache.ts | Updates docs and pipeline creation to stable guarded compute pipeline API. |
| packages/typegpu-noise/src/perlin-2d/static-cache.ts | Updates docs and pipeline creation to stable guarded compute pipeline API. |
| packages/typegpu-noise/src/perlin-2d/dynamic-cache.ts | Updates docs and pipeline creation to stable guarded compute pipeline API. |
| packages/typegpu-geometry/src/lines/constants.ts | Uses stable tgpu.const. |
| apps/typegpu-docs/src/examples/tests/wgsl-resolution/index.ts | Uses stable entry-fn shells. |
| apps/typegpu-docs/src/examples/tests/uniformity/index.ts | Migrates render pipeline creation to root.createRenderPipeline(...). |
| apps/typegpu-docs/src/examples/tests/tgsl-parsing-test/index.ts | Migrates compute shell + compute pipeline creation to stable APIs. |
| apps/typegpu-docs/src/examples/tests/texture-test/index.ts | Migrates fragment shell + render pipeline creation to stable APIs. |
| apps/typegpu-docs/src/examples/tests/log-test/index.ts | Migrates entry functions and guarded pipelines/render pipelines to stable APIs. |
| apps/typegpu-docs/src/examples/tests/dispatch/index.ts | Migrates guarded pipeline usage and .with(...) chaining to stable APIs. |
| apps/typegpu-docs/src/examples/simulation/wind-map/index.ts | Migrates compute/render pipeline creation and entry functions to stable APIs. |
| apps/typegpu-docs/src/examples/simulation/stable-fluid/simulation.ts | Migrates compute entry functions to stable APIs. |
| apps/typegpu-docs/src/examples/simulation/stable-fluid/render.ts | Migrates vertex/fragment entry functions to stable APIs. |
| apps/typegpu-docs/src/examples/simulation/stable-fluid/index.ts | Migrates compute/render pipeline creation to stable APIs. |
| apps/typegpu-docs/src/examples/simulation/slime-mold/index.ts | Migrates guarded compute pipeline + compute/render pipeline creation to stable APIs. |
| apps/typegpu-docs/src/examples/simulation/slime-mold-3d/index.ts | Migrates guarded compute + compute/render pipeline creation to stable APIs. |
| apps/typegpu-docs/src/examples/simulation/gravity/render.ts | Migrates entry functions to stable APIs. |
| apps/typegpu-docs/src/examples/simulation/gravity/index.ts | Migrates pipeline creation chaining to stable APIs. |
| apps/typegpu-docs/src/examples/simulation/gravity/compute.ts | Migrates compute entry functions to stable APIs. |
| apps/typegpu-docs/src/examples/simulation/game-of-life/shaders/vertex.ts | Migrates vertex entry function to stable API. |
| apps/typegpu-docs/src/examples/simulation/game-of-life/shaders/fragment.ts | Migrates fragment entry function to stable API. |
| apps/typegpu-docs/src/examples/simulation/game-of-life/index.ts | Migrates guarded compute + render pipeline creation to stable APIs. |
| apps/typegpu-docs/src/examples/simulation/fluid-with-atomics/index.ts | Migrates entry functions and pipeline creation to stable APIs. |
| apps/typegpu-docs/src/examples/simulation/fluid-double-buffering/index.ts | Migrates entry functions and guarded pipelines/render pipeline creation to stable APIs. |
| apps/typegpu-docs/src/examples/simulation/confetti/index.ts | Migrates entry functions and compute pipeline creation to stable APIs. |
| apps/typegpu-docs/src/examples/simulation/boids/index.ts | Migrates entry functions and render/guarded compute pipeline creation to stable APIs. |
| apps/typegpu-docs/src/examples/simple/vaporrave/index.ts | Migrates entry functions and render pipeline creation to stable APIs. |
| apps/typegpu-docs/src/examples/simple/triangle/index.ts | Migrates entry functions and render pipeline creation to stable APIs. |
| apps/typegpu-docs/src/examples/simple/triangle-next/index.ts | Migrates render pipeline creation to stable API. |
| apps/typegpu-docs/src/examples/simple/stencil/index.ts | Migrates entry functions and render pipeline construction to stable API. |
| apps/typegpu-docs/src/examples/simple/square/index.ts | Migrates entry functions and render pipeline creation to stable API. |
| apps/typegpu-docs/src/examples/simple/ripple-cube/sdf-scene.ts | Migrates accessors to stable tgpu.accessor. |
| apps/typegpu-docs/src/examples/simple/ripple-cube/post-processing.ts | Migrates accessors + guarded compute pipelines + fragment entry fn usage to stable APIs. |
| apps/typegpu-docs/src/examples/simple/ripple-cube/pbr.ts | Migrates accessors to stable tgpu.accessor. |
| apps/typegpu-docs/src/examples/simple/ripple-cube/index.ts | Migrates guarded compute pipelines and chaining to stable APIs. |
| apps/typegpu-docs/src/examples/simple/ripple-cube/background.ts | Migrates guarded compute pipeline chaining to stable APIs. |
| apps/typegpu-docs/src/examples/simple/oklab/index.ts | Migrates render pipeline creation and chaining to stable APIs. |
| apps/typegpu-docs/src/examples/simple/liquid-glass/index.ts | Migrates fragment entry fn + render pipeline creation to stable APIs. |
| apps/typegpu-docs/src/examples/simple/increment/index.ts | Migrates guarded compute pipeline creation to stable API. |
| apps/typegpu-docs/src/examples/simple/gradient-tiles/index.ts | Migrates fragment entry fn + render pipeline creation to stable API. |
| apps/typegpu-docs/src/examples/rendering/xor-dev-runner/index.ts | Migrates entry functions + render pipeline creation to stable API. |
| apps/typegpu-docs/src/examples/rendering/xor-dev-centrifuge-2/index.ts | Migrates entry functions + render pipeline creation to stable API. |
| apps/typegpu-docs/src/examples/rendering/two-boxes/index.ts | Migrates entry functions + render pipeline creation to stable API. |
| apps/typegpu-docs/src/examples/rendering/smoky-triangle/index.ts | Migrates pipeline chaining to stable API. |
| apps/typegpu-docs/src/examples/rendering/simple-shadow/index.ts | Migrates entry functions + render pipeline creation to stable API. |
| apps/typegpu-docs/src/examples/rendering/ray-marching/index.ts | Migrates entry functions + render pipeline creation to stable API. |
| apps/typegpu-docs/src/examples/rendering/point-light-shadow/index.ts | Migrates entry functions and multiple render pipelines to stable API. |
| apps/typegpu-docs/src/examples/rendering/phong-reflection/index.ts | Migrates entry functions + render pipeline creation to stable API. |
| apps/typegpu-docs/src/examples/rendering/perlin-noise/index.ts | Migrates pipeline chaining to stable API. |
| apps/typegpu-docs/src/examples/rendering/jelly-switch/taa.ts | Migrates compute entry fn + compute pipeline creation to stable API. |
| apps/typegpu-docs/src/examples/rendering/jelly-switch/index.ts | Migrates fragment entry fns + render pipelines to stable API. |
| apps/typegpu-docs/src/examples/rendering/jelly-slider/taa.ts | Migrates compute entry fn + compute pipeline creation to stable API. |
| apps/typegpu-docs/src/examples/rendering/jelly-slider/slider.ts | Migrates guarded compute pipeline creation to stable API. |
| apps/typegpu-docs/src/examples/rendering/jelly-slider/index.ts | Migrates fragment entry fns + render pipelines to stable API. |
| apps/typegpu-docs/src/examples/rendering/function-visualizer/index.ts | Migrates render pipeline creation to stable API (keeps raw snippet unstable). |
| apps/typegpu-docs/src/examples/rendering/disco/shaders/vertex.ts | Migrates vertex entry fn to stable API. |
| apps/typegpu-docs/src/examples/rendering/disco/shaders/fragment.ts | Migrates fragment entry fns to stable API. |
| apps/typegpu-docs/src/examples/rendering/disco/index.ts | Migrates render pipeline creation chaining to stable API. |
| apps/typegpu-docs/src/examples/rendering/cubemap-reflection/index.ts | Migrates entry functions + render pipelines to stable API. |
| apps/typegpu-docs/src/examples/rendering/cubemap-reflection/icosphere.ts | Migrates compute entry fn + compute pipeline creation to stable API. |
| apps/typegpu-docs/src/examples/rendering/clouds/index.ts | Migrates fragment entry fn + render pipeline creation to stable API. |
| apps/typegpu-docs/src/examples/rendering/caustics/index.ts | Migrates entry functions + render pipeline creation to stable API. |
| apps/typegpu-docs/src/examples/rendering/box-raytracing/index.ts | Migrates entry functions + render pipeline creation to stable API. |
| apps/typegpu-docs/src/examples/rendering/3d-fish/render.ts | Migrates entry functions to stable API. |
| apps/typegpu-docs/src/examples/rendering/3d-fish/index.ts | Migrates guarded compute pipeline + render pipeline creation to stable API. |
| apps/typegpu-docs/src/examples/image-processing/image-tuning/index.ts | Migrates fragment entry fn + render pipeline creation to stable API. |
| apps/typegpu-docs/src/examples/image-processing/chroma-keying/index.ts | Migrates fragment entry fn + render pipeline creation to stable API. |
| apps/typegpu-docs/src/examples/image-processing/camera-thresholding/index.ts | Migrates fragment entry fn + render pipeline creation to stable API. |
| apps/typegpu-docs/src/examples/image-processing/blur/index.ts | Migrates compute/fragment entry fns + compute/render pipeline creation to stable API. |
| apps/typegpu-docs/src/examples/image-processing/background-segmentation/shaders.ts | Migrates compute entry fn to stable API. |
| apps/typegpu-docs/src/examples/image-processing/background-segmentation/index.ts | Migrates guarded/compute/render pipeline creation to stable API. |
| apps/typegpu-docs/src/examples/image-processing/ascii-filter/index.ts | Migrates render pipeline creation to stable API. |
| apps/typegpu-docs/src/examples/geometry/lines-combinations/index.ts | Migrates entry functions + multiple render pipelines to stable API. |
| apps/typegpu-docs/src/examples/geometry/circles/index.ts | Migrates entry functions + render pipeline creation to stable API. |
| apps/typegpu-docs/src/examples/algorithms/probability/executor.ts | Migrates compute entry fn and compute pipeline creation to stable API. |
| apps/typegpu-docs/src/examples/algorithms/mnist-inference/index.ts | Migrates compute entry fns + compute pipeline creation to stable API. |
| apps/typegpu-docs/src/examples/algorithms/matrix-next/index.ts | Migrates compute pipeline creation to stable API. |
| apps/typegpu-docs/src/examples/algorithms/matrix-next/computeSimple.ts | Migrates compute entry fn to stable API. |
| apps/typegpu-docs/src/examples/algorithms/matrix-next/computeShared.ts | Migrates compute entry fn to stable API. |
| apps/typegpu-docs/src/examples/algorithms/jump-flood-voronoi/index.ts | Migrates guarded compute pipelines + fragment entry fn + render pipeline creation to stable API. |
| apps/typegpu-docs/src/examples/algorithms/jump-flood-distance/visualization.ts | Migrates fragment entry fn to stable API. |
| apps/typegpu-docs/src/examples/algorithms/jump-flood-distance/index.ts | Migrates guarded compute pipelines + render pipeline creation to stable API. |
| apps/typegpu-docs/src/content/docs/integration/react-native/index.mdx | Migrates tutorial to root.createRenderPipeline inline entry functions. |
| apps/typegpu-docs/src/content/docs/fundamentals/variables.mdx | Migrates compute entry fn + compute pipeline creation to stable API. |
| apps/typegpu-docs/src/content/docs/fundamentals/utils.mdx | Updates guarded pipeline example to stable API (keeps raw snippet unstable). |
| apps/typegpu-docs/src/content/docs/fundamentals/timestamp-queries.mdx | Migrates compute pipeline examples to root.createComputePipeline. |
| apps/typegpu-docs/src/content/docs/fundamentals/slots.mdx | Migrates compute entry fn + compute pipeline creation to stable API. |
| apps/typegpu-docs/src/content/docs/fundamentals/resolve.mdx | Migrates compute entry fn + compute pipeline creation to stable API. |
| apps/typegpu-docs/src/content/docs/fundamentals/pipelines.mdx | Migrates entry functions and pipeline creation examples to stable APIs. |
| apps/typegpu-docs/src/content/docs/fundamentals/functions/index.mdx | Migrates guarded compute example and entry-fn bullets to stable APIs. |
| apps/typegpu-docs/src/content/docs/fundamentals/buffers.mdx | Migrates guarded compute pipeline examples to stable API. |
| apps/typegpu-docs/src/content/docs/ecosystem/typegpu-sdf.mdx | Migrates fragment entry fn example to stable API. |
| apps/typegpu-docs/src/content/docs/ecosystem/typegpu-noise.mdx | Migrates entry functions + compute pipeline examples to stable APIs. |
| README.md | Migrates top-level README example to stable guarded compute pipeline API. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
apps/typegpu-docs/src/content/docs/fundamentals/functions/index.mdx
Outdated
Show resolved
Hide resolved
ac67647 to
4c0f4a1
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 122 out of 122 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.
4c0f4a1 to
ec23cbf
Compare
reczkok
left a comment
There was a problem hiding this comment.
auto naming and transpiling tests still use the unstable entrypoint
1a3a0a5 to
de23170
Compare
aleksanderkatan
left a comment
There was a problem hiding this comment.
Concurrent scan still uses the old api
| it(`works with tgpu['~unstable'] items`, async () => { | ||
| const code = `\ | ||
| import tgpu from 'typegpu'; | ||
| import * as d from 'typegpu/data'; | ||
|
|
||
| let nothing, accessor = tgpu['~unstable'].accessor(d.u32); | ||
| const cst = tgpu.const(d.u32, 1); | ||
|
|
||
| console.log(accessor, shell, fn, cst); | ||
| `; | ||
|
|
||
| expect(await rollupTransform(code, { autoNamingEnabled: true })) | ||
| .toMatchInlineSnapshot(` | ||
| "import tgpu from 'typegpu'; | ||
| import * as d from 'typegpu/data'; | ||
|
|
||
| let accessor = ((globalThis.__TYPEGPU_AUTONAME__ ?? (a => a))(tgpu['~unstable'].accessor(d.u32), "accessor")); | ||
| const cst = ((globalThis.__TYPEGPU_AUTONAME__ ?? (a => a))(tgpu.const(d.u32, 1), "cst")); | ||
|
|
||
| console.log(accessor, shell, fn, cst); | ||
| " | ||
| `); | ||
| }); | ||
|
|
There was a problem hiding this comment.
I think this test was accidentally removed instead of updated, since the (outdated) babel version is still here.
No description provided.