Skip to content

0.5.0: async pipelines, the pipeline cache, read/uniform buffers (from ShadyTracer's copy) - #24

Merged
lampmaker merged 1 commit into
mainfrom
claude/kind-noether-finl65
Oct 10, 2026
Merged

lampmaker merged 1 commit into
mainfrom
claude/kind-noether-finl65

Conversation

@lampmaker

Copy link
Copy Markdown
Owner

ShadyTracer kept its own copy of tinywebgpu.js in RAYTRACER_WEBGPU and had moved ahead of the release. ShadyTracer now gets its own repository, which pulls this repository in as a git submodule, so its additions have to land here first. The diff of the source adds only: upstream had nothing the copy lacked.

Added

  • async: true on pipelines:
    • p.pipeline is a getter that stays 0 until p.ready settles.
    • Resources set before then are parked and bound when the pipeline arrives.
    • Dispatching early throws error 24.
  • A per-device compute pipeline cache:
    • p.cached says whether a pipeline came from it.
    • cache: false opts out.
    • It is bounded by G.pipelineCacheMax and G.pipelineCacheChars.
    • It is keyed by the whole text.
  • moduleOnly: true returns { wgsl, module } without a pipeline, and p.wgsl gives the source.
  • The read and uniform resource prefixes.
  • G.timePasses(fn) for per-pass descriptors such as timestampWrites.
  • The adapter's maxStorageBuffersPerShaderStage is now requested.
  • makeCompute and makeCompute2D pass every option through.

Fixed while moving it

  • Wrong error message. An async pipeline still compiling, with its resources already set, said "No resources bound". The pipeline check now runs first.
  • build-min refused the minified output. esbuild folds the new module-level WeakMap into the factory's statement, which broke the export splice. The splice now splits those declarators off.

Tests

  • layout.test.mjs takes the copy's own cases: a write merging into the struct, and read/uniform buffers.
  • It adds cache, async and moduleOnly cases.
  • Checks that rest on DIAG or on internal names run against the source only.
  • npm run test:all passes locally, and dist/ is rebuilt.

Also updated: d.ts, docs/API.md, the CHANGELOG (0.5.0) and package.json.

🤖 Generated with Claude Code

https://claude.ai/code/session_01EyK5zGwaAPiFoLVs2YbzTo


Generated by Claude Code

…ead/uniform buffers (0.5.0)

ShadyTracer kept its own copy of tinywebgpu.js in RAYTRACER_WEBGPU/lib and had moved well ahead of
the release: async pipelines with a ready promise, a per-device compute pipeline cache keyed by the
whole text, moduleOnly, the `read ` and `uniform ` resource prefixes, timePasses, the extra error
scopes, and option pass-through in makeCompute/makeCompute2D. ShadyTracer is moving to a repository
of its own that consumes this one as a submodule, so the copy has to stop being the newer of the two.
The additions are taken whole; upstream had nothing the copy lacked.

Two things the move found. The check a dispatch makes before opening its pass asked for a bind group
before asking for the pipeline, so an async pipeline still compiling, with its resources already
parked, said "No resources bound" to a caller that had bound them; the pipeline is asked first now.
And build-min's export splice refused the minified output, because esbuild folds the module-level
cache declaration into the factory's statement; it now splits those declarators off.

layout.test.mjs takes the copy's own cases (a write merging into the struct, read and uniform
buffers) and gains the cache, async and moduleOnly ones nothing exercised here before. What rests on
DIAG or on internal names is asked of the source build only. npm run test:all passes; dist rebuilt.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EyK5zGwaAPiFoLVs2YbzTo
@lampmaker
lampmaker merged commit ce97b33 into main Oct 10, 2026
1 check passed
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