WebGPU is a web graphics API that offers significant benefits, such as greatly reduced JavaScript workload for the same graphics and more than three times improvements in machine learning model inferences. This is possible because of flexible GPU programming and access to advanced capabilities that WebGL does not provide.
The API is designed with the web platform in mind, featuring an idiomatic JavaScript API, integration with promises, support for importing videos, and a polished developer experience with clear error messages.
WebGPU is the result of a collaborative effort by the W3C's "GPU for the Web" Community Group, which includes contributions from major companies such as Mozilla, Apple, Intel, and Microsoft.
Browser support
This initial release of WebGPU was made available in Chrome 113, on ChromeOS devices with Vulkan support, Windows devices with Direct3D 12 support, and macOS. Linux, Android, and expanded support for existing platforms is coming soon.
WebGPU is a work-in-progress for Firefox and Safari, in addition to the initial implementation in Chrome.
Library support
Many widely used WebGL libraries are already in the process of implementing WebGPU support or have already done so. This means that using WebGPU may only require making a single line change.
- Babylon.js has full WebGPU support.
- PlayCanvas announced initial WebGPU support.
- TensorFlow.js supports WebGPU-optimized versions of most operators.
- Three.js WebGPU support is in progress, see examples.
Both the Dawn library for Chromium and the wgpu library for Firefox are available as standalone package. They offer great portability and ergonomic layers that abstract operating system GPU APIs. Using these libraries in native applications makes it easier to port to WASM through Emscripten and Rust web-sys.
Resources
WebGPU is a significant technology, and we recommend the following resources to learn more:
- Check out the W3C specifications for WebGPU and WGSL.
- Experiment with samples and explore WGSL with a tour.
- Look at the MDN documentation.
- Read the official explainer and best practices.
- Learn about GPU compute and more.