# WebGPU

WebGPU is a JavaScript, C++, Rust, and C API that allows portably and efficiently utilizing a device's graphics processing unit (GPU). This is achieved with the underlying Vulkan, Metal, or Direct3D 12 system APIs. In JavaScript WebGPU can be provided by a web browser or other JavaScript environment such as node.js and Deno. In C++ it can be provided by a C++ implementation of the WebGPU spec, for example, Dawn . In Rust it can be provided by a Rust implementation of the WebGPU spec, for example, wgpu. Other languages like Python, Java, Go can use an implementation that implements the webgpu.h C spec. In the browser, WebGPU is intended to supersede the older WebGL standard. Outside of the browser it provides an easy to use cross platform API for accessing the GPU, currently working on Vulkan (Linux and Android), DirectX (Windows), and Metal (iPhone, iPad, Mac, AppleTV, Apple Watch).
Google Chrome enabled initial WebGPU support in April 2023. Safari and Firefox have not yet enabled theirs. The W3C standard is thus in the working draft phase.

## Technology

WebGPU enables 3D graphics within an HTML canvas. It also has robust support for general-purpose GPU computations.
WebGPU uses its own shading language called WGSL that was designed to be trivially translatable to SPIR-V, until complaints caused redirection into a more traditional design, similar to other shading languages. The syntax is similar to Rust. Tint is a Google-made compiler for WGSL. Naga is a similar project developed for the needs of wgpu-rs.

## Implementations

Both Google Chrome and Firefox support WebGPU with SPIR-V, with work ongoing for the WGSL front-end. Firefox and Deno use the Rust wgpu library. Safari follows upstream specifications of both WebGPU and WGSL.
Chrome version 113 enabled initial WebGPU support on Windows devices with Direct3D 12, ChromeOS devices with Vulkan, and macOS with Metal. This support for Android was enabled in version 121.

## History

On June 8, 2016, Google showed "Explicit web graphics API" presentation to the WebGL working group (during the bi-annual face to face meeting). The presentation explored the basic ideas and principles of building a new API to eventually replace WebGL, aka "WebGL Next".
On January 24, 2017, Khronos hosted an IP-free meeting dedicated to discussion of "WebGL Next" ideas, collided with WebGL working group meeting in Vancouver. Google team presented the NXT prototype implementing a new API that could run in Chromium with OpenGL, or standalone with OpenGL and Metal. NXT borrowed concepts from all of Vulkan, Direct3D 12, and Metal native APIs. Apple and Mozilla representatives also showed their prototypes built on Safari and Servo correspondingly, both of which closely replicated the Metal API.
On February 7, 2017, Apple's WebKit team proposed the creation of the W3C community group to design the API. At the same time they announced a technical proof of concept and proposal under the name "WebGPU", based on concepts in Apple's Metal. The WebGPU name was later adopted by the community group as a working name for the future standard rather than just Apple's initial proposal. The initial proposal has been renamed to "WebMetal" to avoid further confusion.
The W3C "GPU for the Web" Community Group was launched on February 16, 2017. At this time, all of Apple, Google, and Mozilla had experiments in the area, but only Apple's proposal was officially submitted to the "gpuweb-proposals" repository. Shortly after, on March 21, 2017, Mozilla submitted a proposal for WebGL Next within Khronos repository, based on the Vulkan design.
On June 1, 2018, citing "resolution on most-high level issues" in the cross-browser standardization effort, Google's Chrome team announced intent to implement the future WebGPU standard.