WebGPU
{{Short description|Web standard and API}}
{{Infobox technology standard
| title = WebGPU
| image = WebGPU logo.svg
| status = Candidate recommendation (CR)
| year_started = {{Start date|2021|05|18|df=y}}
| first_published = {{Start date|2021|05|18|df=y}}
| version = W3C Candidate recommendation
| version_date = (As of 2025)
| organization = W3C
| editors = {{Plainlist|
- Justin Fan
- Brandon Jones
- Dzmitry Malyshau
- Myles C. Maxfield
- Kai Ninomiya
}}
| domain = {{Plainlist|
}}
| website = {{URL|https://www.w3.org/TR/webgpu/}}
| committee = {{Plainlist|
- GPU for the Web {{abbr|WG|Working Group}}
- GPU for the Web {{abbr|CG|Community Group}}
}}
| related_standards = {{plainlist|
}}
}}
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, [https://dawn.googlesource.com/dawn/ Dawn ]. In Rust it can be provided by a Rust implementation of the WebGPU spec, for example, [https://wgpu.rs/ wgpu]. Other languages like Python, Java, Go can use an implementation that implements the [https://webgpu-native.github.io/webgpu-headers/ 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.{{cite web |title=WebGPU Implementation Status |url=https://github.com/gpuweb/gpuweb/wiki/Implementation-Status |website=GitHub |access-date=14 March 2024}} 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.{{cite web |title=WebGPU API |url=https://developer.mozilla.org/en-US/docs/Web/API/WebGPU_API |website=developer.mozilla.org |access-date=17 March 2024}}
WebGPU uses its own shading language called WebGPU Shading Language (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.[https://gpuweb.github.io/gpuweb/wgsl/ WebGPU Shading Language specification] Tint is a Google-made compiler for WGSL.[https://dawn.googlesource.com/tint Tint source code] Naga is a similar project developed for the needs of wgpu-rs.[https://github.com/gfx-rs/naga Naga source code]
Implementations
Both Google Chrome and Firefox support WebGPU and WGSL. Firefox and Deno use the Rust wgpu library.{{Citation |title=wgpu |date=2024-01-03 |url=https://github.com/gfx-rs/wgpu |access-date=2024-01-03 |publisher=Rust Graphics Mages}} 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.{{Cite web |title=Chrome ships WebGPU |url=https://developer.chrome.com/blog/webgpu-release/ |access-date=2023-04-08 |website=Chrome Developers |language=en}} 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).{{Cite web|url=https://docs.google.com/presentation/d/1FkfvYgwlFmdrx8GhqomFgL0B0ppb6LNXBPT9DyQE0qY|title=Explicit web graphics API|first=Corentin|last=Wallez|access-date=2019-06-25}} 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.{{Cite web|url=https://docs.google.com/presentation/d/1mLQEM__twfivV7nJLDBIomS9pegOYkJQWyM6lTse4PQ|title=WebGL Next investigations|first1=Corentin|last1=Wallez|first2=Kai|last2=Ninomiya|access-date=2019-06-25}} 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.
{{Cite news|url=https://webkit.org/blog/7380/next-generation-3d-graphics-on-the-web/|title=Next-generation 3D Graphics on the Web|date=2017-02-07|work=WebKit|access-date=2018-08-13}}
{{Cite web|url=http://appleinsider.com/articles/17/02/07/apple-seeks-to-position-metal-as-part-of-new-3d-graphics-standard-for-web|title=Apple seeks to position Metal as part of new 3D graphics standard for web|website=AppleInsider|language=en-US|access-date=2018-08-13}}
{{Cite web|url=https://www.theregister.co.uk/2017/02/08/apple_webgpu/|title=Web-standards-allergic Apple unveils WebGPU, a web graphics standard|last=Claburn|first=Thomas|website=The Register |date=2017-02-08|access-date=2017-08-14}}
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.{{Cite mailing list|url=https://groups.google.com/a/chromium.org/d/msg/blink-dev/dxqWTSvyhDg/1UDaFD17AQAJ|title=Intent to Implement: WebGPU|date=2018-05-31|mailing-list=blink-dev|last=Wallez|first=Corentin|access-date=2018-08-13}} The initial proposal has been renamed to "WebMetal" to avoid further confusion.{{Cite web|url=https://webkit.org/blog/7504/webgpu-prototype-and-demos/|title=WebGPU Prototype and Demos|date=2017-04-05|website=WebKit|access-date=2019-01-10}}
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.
{{Cite mailing list|url=https://lists.w3.org/Archives/Public/public-gpu/2017Feb/0002.html|title=Welcome and Getting Started|date=2017-02-16|mailing-list=public-gpu|last=Jackson|first=Dean|access-date=2018-09-11}}
{{Cite web|url=https://github.com/gpuweb/proposals/commit/e608653babcc038c54212e99c941d5511bf76dc2|title=Add Apple's WebGPU proposal|first=Dean|last=Jackson|website=GitHub |access-date=2019-03-08}}
{{Cite web|url=https://kvark.github.io/3d/api/2016/12/17/webmetal.html|title=Prototyping a new 3D API for the Web|first=Dzmitry|last=Malyshau|access-date=2016-12-16}}
Shortly after, on March 21, 2017, Mozilla submitted a proposal for WebGL Next within Khronos repository, based on the Vulkan design.
{{Cite news|url=https://kvark.github.io/web/3d/api/mozilla/2017/03/21/web-platform.html|date=2017-03-21|first=Dzmitry|last=Malyshau|title=Defining the Web platform|access-date=2018-09-11}}
{{Cite web|url=https://github.com/KhronosGroup/WebGLNext-Proposals/pull/2|title=Mozilla's contribution: Obsidian API|first=Dzmitry|last=Malyshau|website=GitHub |access-date=2019-03-08}}
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.
References
{{Reflist}}