April 24, 2023

WebGPU Update


We have updated our WebGPU back-end according to the latest API and WGSL changes. More Tellusim Core SDK WebGPU samples are now functional on web browsers. The most advanced tests are Radix Sort and Fourier Transform, which are the main blocks for many algorithms. The latest Chrome Canary build is required. Unfortunately, Firefox Nightly cannot run any WebGPU samples anymore.

With the help of Clay Shader Compiler we can avoid writing shaders in WGSL. Vertex, Fragment, and Compute shaders can be easily generated from GLSL. You can use it for offline shaders conversion. If needed, we can also create a wasm-based library that can perform shader conversion at run-time upon request.

WGSL is much more restricted than GLSL, but even with these restrictions, we can run Shadertoy demos on WebGPU (you can switch between demos using the `1` and `2` keys). No multi-pass demos are present because they require 32-bit floating point filtration, which is not available at WebGPU.

Responsive image
Responsive image
Responsive image

There are many things that we would like to see in future WebGPU updates because now it’s just less flexible than old-school OpenGLES 3.2:

  • Atomic Operations for non-atomic Buffers

    It gives great flexibility for different algorithms because a single SSBO can be used for different resources.

  • Atomic Operations for Storage Images

    A critical feature for compute rasterization algorithms. It can be emulated with atomic buffers, but there is no direct memory mapping between textures and buffers at WebGPU. Additionally, read-write Storage Image operations are not available.

  • Multi Draw Indirect

    All desktops support it, and it gives a significant efficiency and performance boost. The current WebGPU specification supports only single indirect draw command.

  • User-defined clip distances

    There are only a couple of mobile GPUs that do not support it. It is essential for multiple shadow maps rendering with a single Draw Call.

  • Linear sampling for 32-bit floating point textures

    This is a must-have feature. WebGL can do it.

All of those improvements will help us to run our GPU-driven Scene Graph and Render using WebGPU backend.
We’d love to see GravityMark running on WebGPU in the future!