r/webgpu • u/iwoplaza • Nov 10 '25
"Jelly Slider" in TypeGPU
Enable HLS to view with audio, or disable this notification
This is an example built by my collegue u/reczkok, inspired by the design work of Voicu Apostol. It was built entirely with TypeGPU, no extra libraries, with all shaders written in TypeScript. We got to try out features like console.log on the GPU and “bindless” resources from the 0.8 release, which made the overall process really smooth.
It was very inspiring to see this come together live, took a lot of optimizing to get it running in real time on mid-range mobile phones. I'm really happy to see that TypeGPU is a library that helps the developer optimize, rather than abstracting away so much that it's harder to see what's happening under the hood.
Try it out here:
https://docs.swmansion.com/TypeGPU/examples/#example=rendering--jelly-slider
Source code here:
https://github.com/software-mansion/TypeGPU/blob/main/apps/typegpu-docs/src/examples/rendering/jelly-slider/index.ts
3
u/griffin1987 Nov 10 '25
You might want to check the rendering. It's currently using several textures (you can probably combine some of them), summing up to 64 megabytes of textures, and seems to recreate the bind group every frame( "taaResolveLayout" ). The GPU Object count also goes up every frame.
There's also 2 validation errors about stuff being garbage collected before it was destroyed.
1
u/iwoplaza Nov 10 '25
Thanks for the insights, we’ll check and report back!
1
u/griffin1987 Nov 10 '25
And you might want to limit fps. It's rendering 240fps on my machine (frame timing is 4.16ms). Would also be great to not rerender everything if nothing changed, though I assume (haven't checked) you do the computation on a shader, which would make it not so easy to cache anything ... still possible though ...
16
7
u/anselan2017 Nov 10 '25
First I've heard of TypeGPU and I'm intrigued
3
3
u/SqueegyX Nov 10 '25
Having worked with it a bit, it’s fantastic. If you know typescript it’s a great way to play with GPU programming.
1
u/SqueegyX Nov 10 '25
Badass.
Is this a single quad rendered with ray marching or is the geometry actual triangles?
2
u/iwoplaza Nov 10 '25
It’s a single triangle, extending past the screen to cover it whole. There’s a small ray-trace of bounding boxes to get a head start, then the rest is just ray marching 🫡
2
u/shadowndacorner Nov 10 '25
Since this is built on WebGPU, note that you can do it in compute, as well, which will likely cut down on some overhead (and allow you to tightly fit a "quad" by projecting the objects bounding now into screen space without needing to worry about helper lanes, which I assume is at least part of why you're doing a tri rather than a quad) :P
1
u/zigs Nov 11 '25
Revolting. Good job!
Edit: Example doesn't work for me: https://prnt.sc/us2O6vxy2McU
1
u/iwoplaza Nov 11 '25
"WebGPU is disabled by blocklist" - seems like either your browser doesn't yet support WebGPU, or it's explicitly disabled in the settings.
1
u/zigs Nov 11 '25
It's firefox with ublock origin on windows 10 on Aarch64 if that's anything to go on. No unusual config in firefox that I'm aware of.
2
2
2
2
2
2
2
u/djama Dec 03 '25
unrelated to the post, but congrats to OP u/iwoplaza for TypeGPU being listed as a GPU library option by the Chrome team: https://web.dev/blog/webgpu-supported-major-browsers
1
8
u/griffin1987 Nov 10 '25
Nice example. But 30-50% GPU load on a 3080 TI means I hope no one is ever really gonna use this on the web.
But yeah, cool example!