As the browser becomes more like an operating system, we see more in-depth features built into it. For example, you can now do some form of assembler for the browser. Advanced graphics have been used with WebGL since about 2011, but some people find it difficult to use. [Surma] was one of those people and tried a new method that is just popping up to do the same thing: WebGPU.
[Surma] liked it better and shares a lot of information in the post and – oddly – the post doesn’t use much WebGPU for images. Instead, the post focuses on using GPU cores for fast computation, something you can do with WebGPU as well. However, if your goal is to draw on the screen, you need to know the basics and post links to a site with examples to do it.
Keep in mind that you may need to do something special to enable WebGPU in your browser or switch browsers. While WebGL was a thin shell over OpenGL, WebGPU is an abstraction that can drive Vulkan, Metal, or DirectX 12 – all popular ways to talk to a GPU, depending on your operating system.
The post is long and covers topics like shaders, pipelines, and staging buffers. Of course the API is conceptual and not stable, but it seems substantial enough that what you learn now will probably be useful in the future as well.
We’ve seen GPU processing used to do neural networks in the browser. You may also be interested in GPU.js.
This post WebGPU… Better than WebGL? † hackaday
was original published at “https://hackaday.com/2022/03/09/webgpu-better-than-webgl/”