WebGL is a long standing API that is love and hated by millions - it's stood the test of time - and has been used in an assortment of ways to use the GPU on the web. For all those years, WebGL ruled and there was no alternative! It was used and pushed to its limits as people did not have a choice!
WebGL and WebGPU API
But the times have changed! In the past couple of years a new API has been gradually introduced and integrated into browsers - introducing a new and alternative API for the web - Hello WebGPU.
Instead of continuing to develop and grow the WebGL API - it was decided to introduce a new API that could be develop from scratch - without all the old baggadge and problems.
Of course, while the WebGPU API is shiny and new - it's also 'new' - which means it doesn't have the years of battle testing and experiences that WebGL comes with. At the moment, WebGL is the more mature and experienced graphics API - while WebGPU is the young child stepping up to the table; with it comes a fresh new perspective... a new generation!
The word on the street is that WebGL will always be around... as it's a core part of the web and the web-standards ... but will no longer be updated with new features. While WebGPU will get all of the attention and updates - it is hoped that over the next decade - computers and the web will continue to grow in power - and WebGPU will be the tool to access this power (GPUs - or other parallel architectures, like TPUs, DPUs or QPUs).
Don't abandon WebGL yet!
WebGL is not NOT... dead... it's a key parts of the web-standards and will be for all time in the future. When deciding on which API to use for the web - it's not just about using the fastest, newest most powerful API - it's about which API do you need to do the job!
For instance, if you're not interesting in 3D or high-performance graphics - you might just opt for the traditional HTML Canvas API - which does what needs to do - it isn't trying to replace WebGL or WebGPU.
Remember WebGL is a battle tested API that has been around and is supported by nearly all web-browsers.
New Shader Language (WGSL)
What is more, the new graphics API doesn't use the existing shader languages - but it brings with it - its own shader language called 'WebGPU Shader Language' or WGSL.
This new language is sort of a mix of this and that - JavaScript, Hascall and C++ had a baby - it'd be something like this - it's a bit quirky and takes some time to get used to - but it was designed to meet the needs of shaders for the web (not just reinvent the already popular GLSL)
New shader language built from the ground up to support the new WebGPU API.
While WebGL goes hand-in-handwith GLSL, WebGPU goes hand-in-hand with WGSL.
There is no sideways compatability with the WebGPU and WGSL - especially the shader language - you can't use GLSL with the WebGPU API! Anymore than you can use WGSL with WebGL.
Demos and Examples
There are already a growing number of websites starting to take advantage of the WebGPU API - from high-performance games through to data-analysis and visualization applications.
Hundres of short WebGPU Examples on the WebGPU Lab:
Link WebGPU Lab