Repository navigation
Releases
@typegpu/kit v0.1.3
Released packages:
@typegpu/kitv0.1.3 (requirestypegpu^0.12.11)@typegpu/create-kitv0.1.3
The GPU debug panel works on phones and tablets
The web panel from @typegpu/kit/debug now takes touch. The title bar and corner drag without scrolling the page, and the corner has a finger-sized hit area. Tap a graph column to pin it, then tap it again or anywhere else to let go. On touch screens and narrow panels the buttons get their own row, and Log shows its summary under the graph as well as in the console. Mouse hover works as before.
Change the resolution without restarting a native scene
useScene's maxPixelRatio now resizes the surface when it changes instead of restarting the scene. native.surface and the hosted scene gain setMaxPixelRatio, for a resolution setting in your app.
💎 Features
🗿 Fixes / Stability
- fix(debug): make the web panel usable with touch by @reczkok in #78
- fix(native): present the app as scenes to play, not docs examples by @reczkok in #77
Full Changelog: v0.1.2...v0.1.3
@typegpu/kit v0.1.2
Released packages:
@typegpu/kitv0.1.2 (requirestypegpu^0.12.11)@typegpu/create-kitv0.1.2
Particles that fade into the scene and draw in order
A description can now test against a depth target without writing it: mark the target passes.depthTest, and its drawings can sample that depth while they draw. particles.create builds on it with soft, which fades each quad as the scene behind it comes near, and order, a 'use gpu' key that sorts the quads before they draw, so smoke under blend: 'over' draws back to front.
const tested = passes
.create(root, screen, { hdr: passes.color, depth: passes.depthTest })
.pipe(view.inject());
const smoke = particles.create(root, view, {
capacity: 4096,
step: sim.step,
blend: 'over',
soft: { depth: () => screen.textures.depth, reach: 0.4 },
order: (particle) => {
'use gpu';
const eye = cameras.current.$;
return -std.dot(particle.position - eye.position, cameras.forwardOf(eye));
},
});
const puffs = tested.add(smoke.drawing);Instance sets that a kernel fills
instances.create takes filled, a 'use gpu' function that returns how many rows hold instances this frame. Rows past that count are hidden, so a kernel can write a different number of instances each frame and nothing reads the count back to the CPU.
const gathered = root.createMutable(d.u32); // your gather kernel writes it
const count = gathered.buffer.as('readonly');
const clouds = instances.create(root, pool, {
capacity: 80_000,
filled: () => {
'use gpu';
return count.$;
},
});Cap the frame rate
frames.animate takes maxRate, and web.host, hosting.stage, the React Native host and useScene pass it on. With maxRate: () => 60, a 120 Hz display runs every second refresh.
maxInFlight counts pipelines
pipelines.compile's maxInFlight now limits pipelines, not items, and a module whose initAsync calls pipelines.compile shares the caller's limit. An item that compiles several pipelines used to count once, so the same number now allows fewer compiles at a time.
💎 Features
- feat(passes): test against a depth target without writing it by @reczkok in #58
- feat(particles): fade particles where they meet the scene by @reczkok in #60
- feat(particles): draw particles in the order a hook gives by @reczkok in #62
- feat(instances): skip rows past a count the GPU writes by @reczkok in #61
- feat(pipelines): count maxInFlight in pipelines through nested compiles by @reczkok in #59
- feat(animate): cap the frame rate with maxRate by @reczkok in #57
- feat(environment): add sunShown to fade the sun out at the horizon by @reczkok in #56
- feat(particles): take the burst seed's random source as an option by @reczkok in #55
- feat(native): run the examples app on Android by @reczkok in #69
🗿 Fixes / Stability
- refactor(sorter): reverse scan levels with toReversed as upstream does by @reczkok in #72
- fix(native): keep the theme free of react-native for the chest tests by @reczkok in #71
Full Changelog: v0.1.1...v0.1.2
@typegpu/kit v0.1.1
Released packages:
@typegpu/kitv0.1.1 (requirestypegpu^0.12.11)@typegpu/create-kitv0.1.1
Keep a scene running through uncaptured errors
web.host, hosting.stage and hosting.watch take onUncaptured. It receives each uncaptured GPU error while the frames keep running, so one bad draw doesn't take down the whole scene. A lost device still stops it, and without the option the first uncaptured error stops it as before.
web.host(createScene, options, {
canvas,
onUncaptured: (error) => console.warn(error),
});Cap and cancel pipeline compiles
pipelines.compile takes maxInFlight, which limits how many items compile at once, and signal. After an abort it starts no new items, lets the running ones settle and rejects with the signal's reason.
const loading = new AbortController();
await pipelines.compile(own, { maxInFlight: 4, signal: loading.signal });Frame graphs
The kit now builds on typegpu 0.12.12, which can wrap existing GPU textures and command encoders for renderers that own their resources or their submission. Bloom also rebinds only the pass that reads the source when the source texture changes. Before, it rebuilt about 12 bind groups at 6 levels, every frame a frame graph handed it a fresh texture. The starter pins typegpu 0.12.12.
Sharper upscaled TAA while the camera moves
When TAA upscales, it blends in less of each new frame, so that it can rebuild detail finer than a drawn pixel. While the camera moves, near surfaces slide across far ones and that slow blend used to smear along the motion. With a depth and a camera, the resolve now blends as it does at the drawn size wherever the nearest surface shifts by a drawn pixel or more a frame. Turns and still views look the same as before.
react-native-webgpu 0.23 and React 18
- The native camera feed works on react-native-webgpu 0.23 and later, which renamed
createVideoFrameFromNativeBuffertocreateNativeBufferFromPointer, as well as on 0.21.1 and 0.22. - React is an optional peer of any version, so React 18 web apps can install the kit. Only the native subpaths import React.
💎 Features
- feat(hosting): report uncaptured errors and keep the scene running by @reczkok in #34
- feat(pipelines): cap compiles in flight and stop on an abort signal by @reczkok in #33
🗿 Fixes / Stability
- fix(taa): blend upscaled history as at source size while the eye moves by @reczkok in #13
- fix(native): read camera frames on react-native-webgpu 0.23 by @reczkok in #39
- fix(web): leave a canvas to the surface that configured it last by @reczkok in #32
- fix(bloom): rebind only the first pass when the source changes by @reczkok in #30
- build(deps): upgrade typegpu to 0.12.12 by @reczkok in #29
- build(kit): accept any react version as the optional peer by @reczkok in #28
📖 Docs
- docs: say tsover is optional and the web entries need no react by @reczkok in #35
- docs: show the create command in the landing page hero by @iwoplaza in #12
- docs: link the GitHub repository and Discord in the header by @reczkok in #10
- docs: Yield to the dither haters by @reczkok in #8
Full Changelog: v0.1.0...v0.1.1
@typegpu/kit v0.1.0
Released packages:
@typegpu/kitv0.1.0 (requirestypegpu^0.12.11)@typegpu/create-kitv0.1.0
TypeGPU Kit is now public at software-mansion/typegpu-kit, with docs at docs.swmansion.com/typegpu-kit. Both packages are published from GitHub Actions with npm provenance.
This release:
- settles the names and shapes that 0.1 keeps;
- fixes frames that throw or submit early, prepasses, TAA into bloom and the uniform budget of full scenes;
- makes depth of field and impostor shadows faster;
- keeps the rest of a module out of your bundle when you import one name from it.
Changes to what you write
| Before | Now |
|---|---|
clock.fixedStep(…).advance(dt) |
.update(dt) |
history.create(…).advance(frame) |
.record(frame) |
@typegpu/kit/bake |
@typegpu/kit/fontBaker (the typegpu-kit-bake-font command is unchanged) |
text.flat |
text.ground |
instances.facing(direction) |
instances.toward(direction) |
lighting.create(root, { pointShadow: { … } }) |
lighting.create(root, { pointShadow: pointShadow.define({ … }) }), from @typegpu/kit/pointShadow |
instance hooks material(point, instance, base, carried), and surface and coverage alike |
material(pixel, base), surface(pixel, base), coverage(pixel), where pixel holds point, instance and carried |
a coroutine started inside another ended with it |
start is always detached; scheduler.child(process) starts one that ends with its owner |
Additions
shadow.prepareandpointShadow.preparechoose the layers a frame redraws, so a still shadow skips its pass.web.orbitControls(camera, element, { pointer })shares apointeron the same element and leavestouch-actionto it.useScene'sonFrameoption on React Native runs a callback after each frame, ashost'sonFramedoes.grid.createtakes noitemwhen a kernel reads only slots.@typegpu/kit/inject:byStage,unfilled,Checked,Inject,Injectable.@typegpu/kit/owner:ownerand its types.@typegpu/kit/memo:memo.
@typegpu/kit still exports the names from those three subpaths too. On React Native, import them from the subpaths so Metro doesn't pull in the whole kit.
Stricter at creation
These now throw where you make them:
- capacities past what one dispatch covers on the device, in
grid,liveLists,pickerandmachines; - render limits, named at the option that set them;
- textures to fill with the wrong dimension, usage or format;
- instance kinds without the transform their types promise;
- a custom particle system without its schema;
- holed or out-of-range glTF accessors.
Also:
owner.destroy()frees everything, then throws the first error, or anAggregateErrorof all of them.readback.createwithbytes: trueand nodecodereads anArrayBuffer. A result of another type needsdecode.lighting.createthrows when point shadowcountpasses what the device holds, which is 42 at WebGPU's minimum of 256 texture array layers and at most 157 in a 64 KiB uniform binding.- The mesh pool reads an image when it's added. To change an image, add it again.
Fixes
- Frames:
- Copies the kit records settle at the submit that sends them.
- A frame that throws before its submit no longer loses a table's history copies or TAA's history.
- A host's manual frames stop at the first error and free every step.
- Tables:
- Fields a kernel owns survive a flush of the fields beside them.
- Array fields step by their element alignment.
- Shadows: a layer counts as drawn only once its frame submits.
- Prepasses without colour: an
instancesrenderer in a pass that writes depth andao.normalortaa.motion, withoutpasses.color, draws only its cover and needs no lighting. A translucent renderer in such a pass throws. - TAA into bloom: the TAA resolve no longer outputs negative channels at saturated edges, and bloom cuts negative input before weighting, so no black blocks spread through its mips.
- Uniform budget: the mesh uniform of an indirect draw binds to the vertex stage only, and mesh textures to the fragment stage only. A scene with instances, cameras, TAA, AO, environment light, a sun shadow and a grid uses 10 uniforms per stage instead of 11.
meshPool.textureLayoutis fragment-only now. - Coroutines: a cancelled wait either leaves or resolves, never both; a join that closes a cycle throws.
- glTF: accessor ranges are checked before anything is allocated.
Faster and smaller
- Depth of field: 31% faster at 2560×1440, with the same picture.
- Impostor shadows: 30% faster with 1 600 blended cards.
- Importing one name from a module no longer brings the rest of it. For example,
{ Placement, rotate }frominstancesdrops from 90 KB to 10 KB minified. - Starters: the Lit scene and Finished frame starters build about 6 KB smaller, gzipped, with Vite.
Packages
@pmndrs/glyphpeer is^0.1.0.- The optional React Native peers accept these versions or newer:
react >=19,react-native >=0.88.1,react-native-webgpu >=0.21.1,react-native-worklets >=0.13.1.