Limitations of the WebGPU graphics API
Details about the limitations of WebGPU and how to work around them.
Read time 4 minutesLast updated 13 days ago
The WebGPU graphics API provides useful graphics features. But it also has some limitations you need to be aware of:
- Features with no support in WebGPU
- Check browser and device support
- Compute shader limitations
- GPU readback
- Texture format limitations
- Render texture channels
- Fonts
- Global illumination
- Video
- Shader variants
- Compatibility mode
Features with no support in WebGPU
Although WebGPU unlocks useful graphics features, there are a few it doesn't support yet:
- Async compute
- Dynamic resolution
- Cubemap arrays
Check browser and device support
Although most major browsers support WebGPU, you might need to enable support in the browser's settings. To check your browser's compatibility, refer to Browser compatibility(MDN).
Not all browsers support all WebGPU extensions Unity uses. For example, some texture formats and other extensions aren't available on Safari or Firefox.
Not all devices support WebGPU. To check what devices support WebGPU, refer to Accessing a device(MDN).
Compute shader limitations
There are a few limitations to compute shader in Web.
No RWBuffer support
You can use structured buffers, , but not in compute shaders. Limited read-write storage texture formats WebGPU only supports a limited set of texture formats for read-write storage textures in compute shaders. HLSL doesn’t explicitly state the access type of a storage texture, so it’s based on usage.
RWStructuredBufferRWBufferRWTexture2D<float> tex; // storage texturetex[uv] = 1.0f; // write onlytex[uv] += 1.0f; // read-write
Write-only storage textures are generally much better supported. Refer to Texture format limitations.
Strict uniformity analysis
With WebGPU, you must only call barrier functions from within uniform control flow. Otherwise, WebGPU will fail to compile the shader. Uniform control flow occurs when all threads in a workgroup execute the same code path.
The following are HLSL barrier functions:
GroupMemoryBarrierGroupMemoryBarrirWithGroupSyncDeviceMemoryBarrierDeviceMemoryBarrierWithGroupSyncAllMemoryBarrierAllMemoryBarrierWithGroupSync
Async compute
WebGPU doesn’t support async compute.
No HLSL extended features
WebGPU doesn’t provide support for the following features:
-
Wave Intrinsics (WaveBasic, WaveVote, WaveBallot, WaveMath, WaveMultiPrefix)
-
QuadShuffle
-
Int64
-
Native16Bit
GPU readback
WebGPU doesn’t support synchronous readback of buffer or texture data from the GPU to the CPU. The following functions will not work:
Instead, use the API to read buffer or texture data from the GPU to the CPU. For screen captures, use along with .
AsyncGPUReadbackScreenCapture.CaptureScreenshotIntoRenderTextureAsyncGPUReadbackTexture format limitations
For information about WebGPU texture format capabilities, refer to the W3 documentation on WebGPU. Some formats are more restrictive than on other APIs, especially for storage texture usage.
For example, WebGPU doesn’t support or as a read-write storage texture format. If you do create a RenderTexture with that format, you must set to , which is the default value.
RGBA8RHalfenableRandomWritefalseHowever, WebGPU supports as a storage texture format, so if you create a RenderTexture with format, doesn't need to be .
RFloatRFloatenableRandomWritefalseYou can use SystemInfo.GetCompatibleFormat to find a format that will work for a given usage.
Render texture channels
The output type of a fragment shader must have a greater or equal number of channels as the target render texture format.
If the RenderTexture is RGBA, it has 4 channels. The fragment shader must output a or . If it returns a float or half, WebGPU will encounter an error because there are channels of the render texture that will be uninitialized.
float4half4If a RenderTexture is R8, it has 1 channel. The fragment shader can then output a float or half. The fragment shader can also return a float4 or half4, and the extra output channels will be ignored.
Compatibility mode
Some older devices might not support the maximum WebGPU features and API limits. WebGPU provides a compatibility mode with stricter limits for these devices. Unity automatically falls back to compatibility mode if a device can't support the core WebGPU specifications.
For more information and a full list of limitations, refer to the GPUWeb documentation on compatibility mode.
Notable limitations:
- Render Targets might not have different blending states for the same fragment shader.
- You can't copy compressed and multisampled textures.
- Cube Array textures are unavailable.
- Many texture formats don't support multisampling.
- Lower WebGPU limits.
## General recommendations and limitations for both WebGL2 and WebGPU
Both WebGL2 and WebGPU share the same following recommendations and limitations:
- Recommendations for how to use fonts in Web.
- Restrictions on global illumination in Web.
- Recommendations on how to use video in Web.
- Restrictions on shader variants in Web.
Recommendations for how to use fonts in Web
Unity Web supports dynamic font rendering similar to other Unity platforms. However, Unity Web doesn’t have access to the fonts installed on the user’s machine, so if you want to use any fonts, include them in the project folder (including any fallback fonts for international characters, or bold/italic versions of fonts), and set as fallback font names.
Restrictions on global illumination in Web
Unity Web only supports Baked Global Illumination. Realtime Global Illumination isn’t currently supported in Web. Also, Unity Web supports non-directional lightmaps only.
Recommendations on how to use video in Web
You can’t use to import video clips to your Unity project because it might increase the initial asset data download size and prevent network streaming. To use video playback in Web:
VideoClipImporter- Use the option in the VideoPlayer component.
URL - Place the asset in the directory to use the built-in network streaming of your browser.
StreamingAssets
Restrictions on shader variants in Web
Due to limited available memory in Web, don’t include unwanted shader variants because it can lead to unnecessary memory usage. Therefore, it’s recommended to familiarize yourself with shader variants and shader stripping. Also, take extra care to ensure that you don’t add shaders with too many variants (for example, Unity’s Standard Shader) to the Always-included Shaders section in Graphics Settings.