DEV Community

Cover image for All about WebGPU
Pranav for CODEDAMN

Posted on • Originally published at codedamn.com

All about WebGPU

What is Web GPU?

To understand Web GPU, first, we have to step back and understand what Web GL is. Web GL project started in 2009. Web GL is based on OpenGL (Open Graphics Library) which itself is a software interface to graphics hardware. Web GL is a project that helps you interact with the graphics hardware directly from your browser with the help of Open GL. So before 2009, it was not possible to interact with the GPU by your JavaScript from the browser. So to interact with the Graphics hardware on your computer, you must have Open GL on your computer.

Problem with Web GL

But Windows uses DirectX API to access graphics hardware, so Web GL can't function without Open GL. Therefore Web GL can't be accessed on Windows computers. So the problem here was that Web GL couldn't access DirectX to communicate with the Graphics Hardware. So if you were using a Windows computer, then Web GL must take the help of a software called ANGLE (which acts as a middle man between the Open GL and the windows kernel) to contact the graphics hardware. So now we have a performance hit as now we have had a middle man to access the hardware. So it could be swift if it was possible to communicate with the GPU directly.

Introduction to Vulkan

To fix a middle man problem, a newer standard was developed named "Vulkan". Vulkan has even lower-level access to the graphics hardware so that now it can help build more features with better performance as well.
image
Vulkan is faster compared to both Open GL and DirectX, and it is cross-platform as well. So now we have a better standard developed to access the GPU. Now we need a way to access the Vulkan from the browser. This is where Web GPU comes into play.
image
Vulkan is a performance beast. The process of communicating the graphics hardware is much faster than ever before.

Support for Web GPU

Chrome has already shipped Web GPU as an experimental feature and will most probably be shipped to use from the Chrome 98 version.
image
Now the 3D games can directly run on the computer rather than running on a remote server and sending the data. This may be helpful for running the ML algorithm directly on the client and send the data. This will be a game-changer in the privacy world right now as crucial data need to leave the client's computer.

This is a significant milestone for the future of the Web. The Web GPU may create more promising opportunities for browser gaming and many more applications.

You can watch the YouTube video the blog here.

Top comments (0)