Apple has proposed a new GPU API for the browser, called WebGPU. Google has another solution called NXT in the development.
Major browsers have some support for WebGL when it comes to rendering 3D graphics using some of the features provided by the underlying GPU. But Apple is not happy with it and would like the community to develop another standard that would make use of the latest GPU capabilities and is natively cross-platform. So, they started WebGPU, a W3C Web Community Group.
According to its charter, this new standard should have:
- An API that maps nicely to modern Web platform design patterns
- A lower-level API that allows greater performance in applications
- An API that exposes the GPU computation functionality provided by more modern APIs and available on many devices
- A technology that can be reasonably implemented on all platforms that have a modern, low-level graphics API
and should provide an interface that:
- enables rendering of modern graphics to both onscreen and offscreen drawing surfaces
- enables computation tasks to be performed, and the results of such tasks to be retrieved
- defines a Shading Language that describes the graphics and computation tasks in a format that can be translated or compiled into platform-specific instructions
The API should run on all major OSes on top of existing GPU libraries, such as DirectX 12, Metal or Vulkan.
Dean Jackson from the WebKit team provided some details about WebGPU and the proof-of-concept implementation done by Apple, noting that it started as a mapping of Metal to JavaScript, but they do not want to tie it to Metal. The WebGPU prototype uses the Metal Shading Language but ultimately it “will accept a shader in some IR format, similar to DXIL or SPIR-V.” Jackson also mentioned that there are “some things in Metal that don't quite fit with Vulkan and D3D12.”
Following Apple’s initiative, Google has submitted their proposal and prototype called NXT. Still work in progress, NXT is a cross-platform API inspired by DirectX, Metal and Vulkan; it can be called from JavaScript and WebAssembly and currently runs on OpenGL and Metal. Google can integrate NXT “easily” into Chromium via OpenGL which has been demonstrated by the existing NXT-Chromium project. NXT uses SPIR-V as a shading language.
Some have commented that Apple attempts to push their agenda, and they should rather support Vulkan, the open source GPU API from the Kronos Group. Jackson replied that Vulkan does not have the broad support it needs and it is too low level to be a standard for the web. He reiterated that Apple does not want to push their agenda, saying: “To be clear, WebGPU is just our proposal for a starting point. Other browser engines have their own proposals. Work now goes to W3C.”
And indeed, Apple can influence but cannot decide what a web standard supported by all major browsers will be. It remains to see what the W3C Working Group will decide.