Experimental support for OpenGL ES on Android
You can now access a GPUAdapter
from the OpenGL ES backend when requesting the experimental WebGPU compatibility mode in Chrome for Android. This is especially useful for Android devices lacking support for Vulkan 1.1 or greater. See the following example and issue dawn:1545.
// Request a GPUAdapter in compatibility mode
const adapter = await navigator.gpu.requestAdapter({ compatibilityMode: true });
As this feature is still in an experimental stage, you will need to perform the following steps:
- Enable the following Chrome flags: "Unsafe WebGPU Support", "WebGPU Developer Features", and "Enable command line on non-rooted devices".
- Enable USB Debugging on your Android Device.
- Connect your Android device to your workstation, run
adb shell 'echo "_ --use-webgpu-adapter=opengles" > /data/local/tmp/chrome-command-line'
to prefer the OpenGL ES backend over Vulkan, and restart Chrome.
GPUAdapter info attribute
Getting identifying information about an adapter can now be done in a synchronous way with the GPUAdapter info
attribute. Previously, calling the asynchronous GPUAdapter requestAdapterInfo()
method was the only way to get adapter info. However, requestAdapterInfo()
has been removed from the WebGPU spec and will be removed in Chrome later this year to give enough time to web developers to make the necessary transition. See the following example, Chrome Status, and issue 335383516.
const adapter = await navigator.gpu.requestAdapter();
const info = adapter.info;
// During the transition period, you can use the following:
// const info = adapter.info || await adapter.requestAdapterInfo();
console.log(`Vendor: ${info.vendor}`); // "arm"
console.log(`Architecture: ${info.architecture}`); // "valhall"
WebAssembly interop improvements
To accommodate for WebAssembly heaps being passed directly to WebGPU, the sizes of the following BufferSource arguments are no longer restricted to 2 GB: dynamicOffsetsData
in setBindGroup()
, source data
in writeBuffer()
, and source data
Pin writeTexture()
. See issue 339049388.
Improved command encoder errors
Some validation errors raised from command encoders will now have improved contextual information. For example, attempting to start a compute pass while a render pass was still open resulted in the following error.
Command cannot be recorded while [CommandEncoder (unlabeled)] is locked and [RenderPassEncoder (unlabeled)] is currently open.
at CheckCurrentEncoder (..\..\third_party\dawn\src\dawn\native\EncodingContext.h:106)
This does describe the reason for the error, however it doesn't indicate which call actually caused the validation error. The following error shows the improved messaging which includes the command that triggered the error. See change 192245.
Command cannot be recorded while [CommandEncoder (unlabeled)] is locked and [RenderPassEncoder (unlabeled)] is currently open.
- While encoding [CommandEncoder (unlabeled)].BeginComputePass([ComputePassDescriptor]).
Dawn updates
The webgpu.h C API no longer exposes wgpuSurfaceGetPreferredFormat()
, the C equivalent of Dawn's wgpu::Surface::GetPreferredFormat()
. Instead, use wgpu::Surface::GetCapabilities()
to get the list of supported formats, then use formats[0]
to get the texture format preferred for this surface. In the meantime, calling wgpu::Surface::GetPreferredFormat()
emits a deprecation warning. See issue 290.
The supported texture usages of a surface are now available through wgpu::SurfaceCapabilities::usages
when calling wgpu::Surface::GetCapabilities()
. They are expected to always include wgpu::TextureUsage::RenderAttachment
. See issue 301.
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 129
Chrome 128
- Experimenting with subgroups
- Deprecate setting depth bias for lines and points
- Hide uncaptured error DevTools warning if preventDefault
- WGSL interpolate sampling first and either
- Dawn updates
Chrome 127
- Experimental support for OpenGL ES on Android
- GPUAdapter info attribute
- WebAssembly interop improvements
- Improved command encoder errors
- Dawn updates
Chrome 126
- Increase maxTextureArrayLayers limit
- Buffer upload optimization for Vulkan backend
- Shader compilation time improvements
- Submitted command buffers must be unique
- Dawn updates
Chrome 125
Chrome 124
- Read-only and read-write storage textures
- Service workers and shared workers support
- New adapter information attributes
- Bug fixes
- Dawn updates
Chrome 123
- DP4a built-in functions support in WGSL
- Unrestricted pointer parameters in WGSL
- Syntax sugar for dereferencing composites in WGSL
- Separate read-only state for stencil and depth aspects
- Dawn updates
Chrome 122
- Expand reach with compatibility mode (feature in development)
- Increase maxVertexAttributes limit
- Dawn updates
Chrome 121
- Support WebGPU on Android
- Use DXC instead of FXC for shader compilation on Windows
- Timestamp queries in compute and render passes
- Default entry points to shader modules
- Support display-p3 as GPUExternalTexture color space
- Memory heaps info
- Dawn updates
Chrome 120
- Support for 16-bit floating-point values in WGSL
- Push the limits
- Changes to depth-stencil state
- Adapter information updates
- Timestamp queries quantization
- Spring-cleaning features
Chrome 119
- Filterable 32-bit float textures
- unorm10-10-10-2 vertex format
- rgb10a2uint texture format
- Dawn updates
Chrome 118
- HTMLImageElement and ImageData support in
copyExternalImageToTexture()
- Experimental support for read-write and read-only storage texture
- Dawn updates
Chrome 117
- Unset vertex buffer
- Unset bind group
- Silence errors from async pipeline creation when device is lost
- SPIR-V shader module creation updates
- Improving developer experience
- Caching pipelines with automatically generated layout
- Dawn updates
Chrome 116
- WebCodecs integration
- Lost device returned by GPUAdapter
requestDevice()
- Keep video playback smooth if
importExternalTexture()
is called - Spec conformance
- Improving developer experience
- Dawn updates
Chrome 115
- Supported WGSL language extensions
- Experimental support for Direct3D 11
- Get discrete GPU by default on AC power
- Improving developer experience
- Dawn updates
Chrome 114
- Optimize JavaScript
- getCurrentTexture() on unconfigured canvas throws InvalidStateError
- WGSL updates
- Dawn updates