Chrome 113 activates WebGPU, a modern, low-overhead graphics API for the web.

Google today announced that it will be enabling WebGPU support in its default Chrome browser starting with version 113, which is currently in beta. WebGPU, in development since 2017, is a next generation graphics API that aims to take advantage of low overhead APIs such as Microsoft Direct3D 12, Apple Metal, and Vulkan in web browsers and other applications.

WebGPU support has been available for some time, but is disabled by default in Chrome because the API hasn’t been finalized and things could break from update to update. Google says both Mozilla and Apple will eventually support WebGPU in Firefox and Safari, and browsers like Microsoft Edge and Opera that rely on the Chromium browser engine could conceivably enable it, as Google did.

Chrome 113 supports WebGPU on Windows, macOS, and ChromeOS to begin with, while “support for other platforms”like Linux and Android “is coming later this year.”This version of the browser should become available to all Chrome users sometime in May.

Support in Chrome is a big step forward for any new standard, whether it’s a new or updated API, image format, or video codec. According to StatCounter, Chrome itself accounts for roughly two-thirds of the browser market share worldwide, and almost 80 percent of the total browser market share if you count other Chromium-based browsers. Once Safari and Firefox add support, virtually all web browsers around the world will be able to run WebGPU code, so it’s worth briefly explaining what WebGPU is and why it exists.

What is Web GPU?

WebGPU is sort of the successor to WebGL, a much older API that allows you to display OpenGL-based graphics in your browser without requiring additional third-party plugins like Adobe Flash. While WebGL was revolutionary when it was announced in 2009, today it suffers from many of the same problems as OpenGL: it doesn’t take full advantage of modern GPUs, it can lose performance due to driver overhead, and it only has limited opportunities. and clunky support for GPU compute loads.

“While WebGL is primarily designed for drawing images, but can be repurposed (with more effort) to perform other kinds of computation, WebGPU has top-notch support for performing general computation on the GPU,”reads a draft document explaining why there is WebGPU. The new API will improve graphics in environments like Babylon.js and game engines like Unity; will support GPU-accelerated workloads like those used for machine learning and artificial intelligence; and can make it easier for photo and video web apps (among others) to take advantage of the GPU acceleration that native apps benefit from.

WebGPU is being developed by a working group that includes representatives from Google, Microsoft, Apple, Mozilla, Intel, and many other companies, and as a result, the API has been designed to be as widely compatible as possible. WebGPU is not a direct implementation of any existing graphics API, but is a native API that sits on top of and interacts with Direct3D 12, Metal, and Vulkan. This explainer from Surma, a Shopify engineer and former Google employee, sums it up nicely (our emphasis):

“While WebGL is just a thin wrapper around OpenGL, WebGPU has taken a different approach. It introduces its own abstractions and does not directly reflect any of these native APIs. This is partly because no single API is available on all systems, but also because many concepts (such as extremely low-level memory management) are not idiomatic for Web API. Instead, the WebGPU was designed to feel “weblike”and conveniently sit on top of any of the native graphics APIs, abstracting away their idiosyncrasies. It’s standardized in the W3C and all the major browser vendors are sitting around the table.”

This has the advantage that WebGPU code becomes very portable – write WebGPU code and as long as users have hardware and a browser that supports it, you should get the same result on a Windows system with Direct3D and on an Android phone with Vulkan. And it avoids some of the hacks that keep WebGL working – for example, WebGL on Windows and macOS doesn’t even use OpenGL directly, but instead uses a translator called ANGLE, which turns OpenGL API calls into Direct3D and Metal API calls instead. With WebGPU, there is no need to start a completely separate project to write a slow or poorly maintained implementation of OpenGL.

WebGPU also has its own shader language (WGSL), which the Chrome team is still working on supporting – today’s announcement says that Google “plans to provide deeper access to shader cores”via WGSL in a future release. Like the rest of the WebGPU API, WGSL is platform independent and easily translates to the preferred shader language of whatever operating system you use it on.

Finally, despite the word “network”in the name, the WebGPU API is not limited to browsers. The wgpu project is Rust’s version of WebGPU that allows you to write WebGPU applications and run them outside of web browsers.

If you want to experiment with WebGPU now, Chrome 113 beta is available here. A GitHub repository with code samples is available here, and there is official documentation for both WebGPU and WGSL.

CDN CTB