WebGPU is the hot topic right now. A brand-new web API that will most likely replace WebGL sooner rather than later (I won't miss you, bro đ).
Itâs already supported by all major browsers, and honestly⌠how could I not try it?
So I did what any curious frontend-centric software dev would do: I built a small interactive demo and learned a lot more than I initially expected.
First things first: why GPUs?
For many of you this might sound obvious, but letâs do a quick intro for anyone new to this area.
CPUs are great at doing a few complex things one after another.
GPUs are great at doing simple things, massively in parallel.
Thatâs why GPUs shine in:
- graphics and image processing
- simulations
- matrix-heavy workloads
- and yes â things like LLMs
Whether youâre rendering pixels, blurring textures, or multiplying huge matrices, GPUs are simply built for this kind of work. WebGPU finally gives us proper access to that power directly in the browser.
So⌠how is this different from WebGL?
WebGL is based on OpenGL, which is⌠well⌠old. Very old in GPU years.
With WebGL:
- there were no real compute shaders
- everything had to be expressed as a ârendering problemâ
- lots of hacks, tricks, and workarounds
- a lot of hidden global state
If you ever implemented GPGPU in WebGL, you probably remember encoding data in textures and pretending triangles were something else entirely đ
WebGPU fixes this properly:
- explicit compute passes
- explicit pipelines and bind groups
- no magical global state
- APIs that map directly to modern GPU architectures (Metal, Vulkan, DirectX 12)
In short: WebGPU is how GPUs actually work today.
Is WebGPU production-ready?
The honest answer: it depends.
If you can:
- require modern browsers
- target up-to-date Chrome, Edge, Firefox, Safari
â then yes, WebGPU is absolutely usable today.
If, however:
- you have a very broad audience
- someone out there is still using an ancient Safari
- or (please no) IE 11
â then you either invest in a WebGL fallback, or you skip WebGPU for now.
For experiments, demos, internal tools, and forward-looking products?
Itâs already a very solid choice.
WGSL â those âweirdâ new shader files
WebGPU introduces WGSL (WebGPU Shading Language).
At first glance, it looks strange â but if youâve ever seen shaders for:
- Metal
- Vulkan
- or modern DirectX
âŚit actually feels quite familiar.
WGSL is:
- strongly typed
- explicit
- designed to avoid a whole class of GPU bugs
In this project I keep shaders in separate .wgsl files, but you can also inline them as strings in TypeScript if you want. VS Code already has syntax highlighting for WGSL in both cases, which helps a lot.
Now, about my demo
I wonât lie â this demo was harder to write than many of my other experiments.
Maybe itâs because WebGPU is still relatively fresh.
Or maybe itâs because Iâve never been particularly passionate about computer graphics⌠and this demo is very graphics-heavy.
But in the end? Iâm really happy with the result.
Visually, it looks like glowing ink or smoke that appears when you move your cursor across the canvas.
Technically, itâs a GPU-driven simulation where:
- pointer input injects color into a floating-point texture
- compute shaders blur and transport that data over time
- values slowly fade out, creating trails
- a render pass displays the result
Is it physically accurate? Absolutely not đ
Does it look cool? Oh yes.
Live parameters like trail length, brush size, swirl strength, and color can all be tweaked via a control panel â no shader recompilation needed.
React⌠for a WebGPU demo?
Most WebGPU demos youâll find are written in plain HTML + JS. I couldâve done that too.
But I decided to use React + TypeScript as a thin wrapper:
- clean UI
- easy state management for sliders
- zero manual DOM wiring
It worked great â with one important caveat.
To make this demo usable, I had to disable React Strict Mode.
Why? Because Strict Mode intentionally runs effects twice in development to detect side effects. Thatâs normally fantastic⌠but not when youâre creating GPU devices, pipelines, textures, and buffers. Double initialization can break things very quickly.
Low-level GPU code is one of those rare cases where Strict Mode gets in the way.
A TypeScript gotcha
One more small thing:
TypeScript doesnât ship WebGPU types fully enabled out of the box yet.
You need to explicitly enable WebGPU typings in your TS config, otherwise none of the GPU types will exist. Itâs a one-time setup, but worth mentioning if youâre trying this for the first time.
Links
Repository:
https://github.com/sylwia-lask/webgpu-neon-demo
Final thoughts
WebGPU feels like a real step forward for the web.
Not just âslightly better graphicsâ, but an entirely new class of things we can realistically build in the browser.
This demo is just a visual experiment â but it already shows how powerful, expressive, and fun GPU-driven web apps can be.
If youâve been curious about WebGPU⌠this is your sign to try it đ
Top comments (58)
This demo is đĽ, Sylwia! WebGPU + React makes it so approachable, and the glowing trails effect is mesmerizing. Your explanation of WGSL and compute shaders really demystifies what feels like a ânext-gen webâ APIâdefinitely excited to try this in my own projects! đ
Thank you so much! đđĽ
Good luck with your project â and please do share what you build, Iâd love to see it! đ
It works on mobile! Really well actually, I just stared at the swirlies for 10 minutes while waiting for my croque monsieur đ I'm kinda sad I can't think of any project right now where I could utilize webgpu... I like that you put in the extra effort to figure out how to work with it in React + typescript đ
I actually had to look up what a croque monsieur is - and now I made myself hungry đ
Really glad it works well on your phone! Though yeah, unfortunately WebGPU still isnât supported everywhere yet đ
Fantastic! Iâd been waiting for this article, and it was absolutely worth it. I finally understand the value of WebGPU (even if, for my personal use cases, itâs still fairly limited). I played with the demo â itâs brilliant. Tweaking the settings and seeing everything update live is genuinely enjoyable.
Thank you so much, Pascal! Iâm really glad the article and the demo helped clarify the value of WebGPU đ
And yes â I totally agree. In day-to-day dev work the use cases can feel pretty limited⌠until they suddenly arenât. Iâve had more than a few moments where a âsimpleâ feature turned into something that really needed serious performance, and then having tools like this starts to matter a lot đ
Absolutely â same here. And to be honest, given the kind of projects Iâm working on, I donât expect to need WebGPU anytime soon. But I was curious to see what it felt like in practice: the possibilities, the rendering, the kind of problems it can unlock down the road.
And your demo was perfect for that â it gave me a clear sense of where this tech could matter later, even if today my use cases stay pretty modest. Still, itâs great to see whatâs coming. đ
That was exactly my goal with the demo: not to push WebGPU as something everyone needs now, but to give a tangible feel for what it unlocks when the time comes. Even if today the use cases are modest, itâs exciting to see whatâs ahead. đ
Great article Sylwia as usual
Thanks, Ben đ Always nice to see you here!
You are welcome! Yes, indeed:)
I am here or LinkedIn:)
Thanks for the article, itâs exciting to see how this API could push web graphics forward. From my own experience, the challenge is that in real projects we often canât fully use these advanced features. For example, even when working with WebGL maps, we still usually have to provide a Canvas fallback because not all users support it. Hopefully WebGPU adoption speeds up over time :)
Thanks for the comment! Yes, thatâs exactly how it looks in larger, commercial projects. Fallbacks are often unavoidable, and I think this will remain the case for a while. WebGPU without a fallback will probably make sense first in environments where you can enforce modern browsers.
That said, WebGPU feels much more flexible than WebGL, so Iâm cautiously optimistic that adoption - and real-world usability - will improve over time đ
We loved your post so we shared it on social.
Keep up the great work!
I really appreciate the distinction you made between WebGLâs 'hacks' and WebGPUâs explicit design. Weâre essentially trading the comfort of high-level abstractions for the predictability of modern GPU architectures like Vulkan or Metal. Itâs a significant shift in the mental model for web devs, but moving away from that 'magical global state' is a necessary step for building truly resilient, high-performance browser tools
Thank you â thatâs a great way to put it.
That shift in mental model is probably the hardest part, but also the most valuable one. Losing the âmagicalâ global state can feel uncomfortable at first, yet it gives you predictability and control that simply werenât possible with WebGL. For long-lived, performance-critical tools in the browser, that trade-off really starts to make sense.
I think the killer feature will be when secondary (non-JS) languages get more streamlined access to the WebGPU runtime--WASM in particular. I could see a batched command buffer approach helping with some sort of minimal shim but I'd rather do away with the need altogether!
Oh... and this was the killer anti-feature that made me finally drop Firefox (will miss you!). Can't believe how long this API was in experimental/beta.
Yesss, totally agree đ Thanks for the comment - Iâm 100% on the same page.
If WASM ever gets cleaner access to WebGPU or somehow to the DOM/browser APIs, weâre basically set. And yeah⌠the Firefox wait really hurt đĽ˛
Hi Sylwia,
This is awesome, thanks for your post. I just could go thru the live demo but will check the code asap.
Hi! Iâm really glad you liked it - thanks a lot đ
Hope youâll enjoy digging into the code as well!
I'm having too much fun with the demo
Haha, then the demo is doing exactly what itâs supposed to do đ
Some comments may only be visible to logged-in visitors. Sign in to view all comments.