What's New in WebGPU (Chrome 117)

François Beaufort
François Beaufort

Unset vertex buffer

Passing null rather than a GPUBuffer to setVertexBuffer() on GPURenderPassEncoder or GPURenderBundleEncoder allows you to unset a previously set vertex buffer in a given slot. See issue dawn:1675.

// Set vertex buffer in slot 0.
myRenderPassEncoder.setVertexBuffer(0, myVertexBuffer);

// Then later, unset vertex buffer in slot 0.
myRenderPassEncoder.setVertexBuffer(0, null);

Unset bind group

Passing null rather than a GPUBindGroup to setBindGroup() on GPURenderPassEncoder or GPURenderBundleEncoder allows you to unset a previously set bind group in a given slot. See issue dawn:1675.

// Set bing group in slot 0.
myRenderPassEncoder.setBindGroup(0, myBindGroup);

// Then later, unset bind group in slot 0.
myRenderPassEncoder.setBindGroup(0, null);

Silence errors from async pipeline creation when device is lost

The createComputePipelineAsync() and createRenderPipelineAsync() methods of GPUDevice return a promise which resolves when the creation of the pipeline has completed. From now on, errors from async pipeline creation will be silenced when the GPUDevice is lost to make lost devices appear to function as much as possible. See dawn issue:1874.

SPIR-V shader module creation updates

Creating a SPIR-V shader module with createShaderModule() now throws a TypeError unless you run Chrome with the "Unsafe WebGPU Support" flag as SPIR-V is not part of the WebGPU specification. Prior to this change using SPIR-V would cause a GPUInternalError to be generated instead. See change chromium:4711911.

Improving developer experience

The validation error message for bind group layout bindings in vertex shader has been improved for read-write storage buffer and write-only storage texture bindings. See issue dawn:1883.

Caching pipelines with automatically generated layout

Pipelines created with createRenderPipeline({ layout: "auto" }) now take advantage of caching mechanisms in Chrome. It means that these pipelines will be created more efficiently and will use less memory. See issue dawn:1933.

Dawn updates

The wgpu::RequestAdapterOptionsBackendType is now part of wgpu::RequestAdapterOptions to make it easier for applications to request a particular backend when getting an adapter. See the following example and issue dawn:1875.

wgpu::RequestAdapterOptions options = {
    .backendType = wgpu::BackendType::D3D12};

// Request D3D12 adapter.
myInstance.RequestAdapter(&options, myCallback, myUserData);

Several additional methods have been implemented for Node.js. See change dawn:142465.

The webgpu.h C API has changed its type for boolean values from stdbool to WGPUBool, which is a uint32_t. This change was made to ensure that the API has an equivalent ABI in C and C++.

This covers only some of the key highlights. Check out the exhaustive list of commits.

What's New in WebGPU

A list of everything that has been covered in the What's New in WebGPU series.

Chrome 122

Chrome 121

Chrome 120

Chrome 119

Chrome 118

Chrome 117

Chrome 116

Chrome 115

Chrome 114

Chrome 113