Capturing the WebGPU ecosystem

Capturing the WebGPU ecosystem

WebGPU is often perceived as a web graphics API that grants unified and fast access to GPUs by exposing cutting-edge hardware capabilities and enabling rendering and computation operations on a GPU, analogous to Direct3D 12, Metal, and Vulkan.

However, WebGPU transcends the boundaries of a mere JavaScript API; it is a fundamental building block akin to WebAssembly, with implications that extend far beyond the web due to its burgeoning ecosystem. The Chrome team acknowledges WebGPU as more than just web technology; it’s a thriving ecosystem centered around a core technology.

Exploring the current ecosystem

The journey begins with the JavaScript specification, a collaborative effort involving numerous organizations such as Apple, Google, Intel, Mozilla, and Microsoft. Currently, all major web browsers have implemented or are in the process of implementing WebGPU.

At the same time, Mozilla and Google recognized WebGPU’s potential in platform-specific applications and separated WebGPU implementations from browsers, enabling standalone usage.

For Chrome, this materialized as Dawn, a C/C++ library that translates WebGPU calls into GPU driver commands. Dawn empowers C and C++ applications to use WebGPU natively, providing a portable and ergonomic GPU abstraction using browser vendor expertize.

As demonstrated in the blog post WebGPU: the cross-platform graphics API of tomorrow, porting a platform-specific WebGPU application to the web is straightforward. Emscripten, the C++ WebAssembly toolchain, already supports WebGPU, requiring only minimal modifications to port it to the web.

You can also run your JavaScript WebGPU code outside the browser with the Node.js JavaScript runtime as it includes a WebGPU module based on Dawn. It allows you to run your code without modifications server-side or in other platform-specific contexts.

A similar ecosystem exists for Rust with wgpu, Firefox’s implementation of WebGPU. Wgpu can be directly integrated into Rust applications, which can then be ported to the web using web-sys. Additionally, the Deno JavaScript runtime supports WebGPU through wgpu. See wgpu alliance with Deno blog post.

This establishes a parallel ecosystem between Rust and C++ as shown in the following diagram.

Diagram of the WebGPU ecosystem in 2023.
WebGPU ecosystem in 2023.

Emerging horizons

The WebGPU ecosystem extends beyond the JavaScript, C++, and Rust realms.

Your preferred programming language may actually already have bindings for WebGPU as engineers working on WebGPU implementations are also developing a common C header for WebGPU. This can be used to target Dawn, wgpu, and others, easing the creation of bindings for languages using C FFI.

The Chrome team is also considering using Dawn as the default rendering backend for all browser UI elements, including menus, toolbars, developer tools, and web content. This would eliminate the need for separate rendering implementations for each native API, simplifying the development process. This feature is currently in the experimental stage on macOS and Windows behind the chrome://flags/#skia-graphite flag.


Hero image by Daniel Öberg on Unsplash.

This post is also available in: English