WebGPU support comes to nightly versions of Firefox

Information on integrating the WebGPU help specification released in Firefox nightly builds, which now provides a programming interface for 3D graphics processing and computing on the GPU side, conceptually similar to the Vulkan API, metal and Direct3D 12. The specification is being developed by Mozilla, Google, Apple, Microsoft and community representatives in a working group created by the organization W3C.

The key goal of WebGPU is to create a secure, convenient, portable, and high-performance software interface for use on the web platform with 3D graphics technology and capabilities provided by modern system graphics APIs such as Direct3D 12 on Windows, Metal on macOS, and Vulkan on Linux.

Conceptually, WebGPU differs from WebGL in the same way Vulkan differs from OpenGL and it is not based on a specific graphics API, rather it is a universal layer, in general, using the same low-level primitives that are available in Vulkan, Metal, and Direct3D.

In Firefox, "dom.webgpu.enabled" setting is provided to enable WebGPU in about: config. In addition to rendering CanvasContext, it also requires the inclusion of the WebRender composition system ("gfx.webrender.all" in about: config).

The WebGPU implementation is based on the wgpu project code written in Rust and can work on top of the DX12, Vulkan, and Metal APIs on Linux, Android, Windows, and macOS (DX11 and OpenGL ES 3.0 support is also in development).

About WebGPU

WebGPU provides JavaScript applications with tools for lower-level control about the organization, the processing and transmission of commands to the GPU, managing related resources, memory, buffers, texture objects, and compiled graphical shaders. This approach will enables higher performance graphics applications by reducing overhead and increasing the efficiency of working with the GPU.

WebGPU makes it possible to create complete complex 3D projects for the web that do not perform worse than standalone programs that communicate directly with Vulkan, Metal, or Direct3D, but are not tied to specific platforms.

As well provides additional capabilities by porting native graphics programs to a form that can function on the basis of web-based technologies by using WebAssembly technology.

In addition to the 3D graphics, WebGPU also covers the possibilities associated with eliminating computing next to the GPU and support for shader development. Shaders can be created in the WebGPU shader language or specified in the SPIR-V intermediate format, and then translated into shader languages ​​supported by current drivers.

WebGPU uses separate resource management, preparatory work, and command transfer to the GPU (in WebGL, one object was responsible for everything at once). Three separate contexts are provided: GPUDevice for creating resources such as textures and buffers; GPUCommandEncoder to encode individual commands, including rendering and computation stages; GPUCommandBuffer to queue for execution on the GPU.

The second difference between WebGPU and WebGL is a different approach to handling states. Two objects are proposed in WebGPU: GPURenderPipeline and GPUComputePipeline, which allow combining several states predefined by the developer, which allows the browser not to waste resources on additional work, such as recompiling shaders. Supported states include: shaders, vertex buffer and attribute layouts, attached group layouts, blending, depth and patterns, post-rendering output formats.

The third feature of WebGPU is the binding model, which in many respects resembles the means of pooling resources present in Vulkan. To group resources into groups, WebGPU provides a GPUBindGroup object that, by typing commands, can be associated with other similar objects for use in shaders.

The creation of such groups allows the driver to perform the necessary preparatory actions in advance, and the browser allows him to switch resource links between pull calls much faster.

Source: https://hacks.mozilla.org/

The content of the article adheres to our principles of editorial ethics. To report an error click here!.

Be the first to comment

Leave a Comment

Your email address will not be published. Required fields are marked with *



  1. Responsible for the data: AB Internet Networks 2008 SL
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.