GPUSupportedFeatures

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

Want more browser support for this feature? Tell us why.

Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.

Note: This feature is available in Web Workers.

The GPUSupportedFeatures interface of the WebGPU API is a Set-like object that describes additional functionality supported by a GPUAdapter.

The GPUSupportedFeatures object for the current adapter is accessed via the GPUAdapter.features property — use this to test what features your current setup supports. To create a GPUDevice with a specific feature enabled, you need to specify it in the requiredFeatures array of the GPUAdapter.requestDevice() descriptor.

Not all features will be available to WebGPU in all browsers that support it, even if the underlying hardware supports those features. This could be due to constraints in the underlying system, browser, or adapter. For example:

  • The underlying system might not be able to guarantee exposure of a feature in a way that is compatible with a certain browser.
  • The browser vendor might not have found a secure way to implement support for that feature, or might just not have gotten round to it yet.

If you want to use a specific additional feature in a WebGPU app, test it thoroughly.

Available features

The following additional features are defined in WebGPU. Bear in mind that the exact set of features available will vary across implementations and physical devices and will change over time.

bgra8unorm-storage

When enabled, allows STORAGE_BINDING usage of bgra8unorm-format GPUTextures.

clip-distances

When enabled, allows the use of clip_distances in WGSL.

core-features-and-limits

When enabled, signifies that the GPUAdapter / GPUDevice is able to use all "core" WebGPU features and limits, which allows applications to support devices that use modern platform graphics APIs. By default, all adapters have the core-features-and-limits feature enabled, and therefore support core WebGPU. To create a "compatibility mode" adapter, specify a featureLevel value of compatibility in your GPU.requestAdapter() call. Compatibility mode provides support for older graphics APIs (such as Direct3D 11 and OpenGL ES 3.1) at the expense of performance and feature set.

Note that a compatibility mode adapter will only be created on devices that don't support core WebGPU. On devices that do support core WebGPU, the adapter will support core WebGPU (core-features-and-limits will be enabled), and you can go ahead and use modern features (see Using compatibility mode only if necessary for an example of how this works).

depth-clip-control

When enabled, allows depth-clipping to be disabled. If depth-clip-control is enabled, the unclippedDepth property is available on the primitive object included as part of the createRenderPipeline() or createRenderPipelineAsync() descriptor when creating a GPURenderPipeline. primitive describes how a pipeline constructs and rasterizes primitives from its vertex inputs. Set unclippedDepth to true to disable depth-clipping.

depth32float-stencil8

When enabled, allows creation of textures with the format depth32float-stencil8. If depth32float-stencil8 is enabled, the depth32float-stencil8 value can be used for the format property of the createTexture() descriptor when creating a GPUTexture.

dual-source-blending

When enabled, allows the use of dual_source_blending in WGSL, which uses both pixel shader outputs (@blend_src(0) and @blend_src(1)) as inputs to a blending operation with the single color attachment at @location(0). Over in WebGPU, dual-source-blending enables the following blend factor operations (specified in the dstFactor and srcFactor properties of createRenderPipeline() and createRenderPipelineAsync() descriptors): src1, one-minus-src1, src1-alpha, and one-minus-src1-alpha.

float32-blendable

When enabled, allows blending of GPUTextures that use the r32float, rg32float, or rgba32float format.

float32-filterable

When enabled, allows filtering of GPUTextures that use the r32float, rg32float, or rgba32float format.

indirect-first-instance

When enabled, allows the use of non-zero firstInstance values in the indirectBuffer property of the drawIndirect() and drawIndexedIndirect() methods available on GPURenderPassEncoder and GPURenderBundleEncoder instances.

primitive-index

When enabled, allows the use of the primitive_index built-in variable in WGSL. This built-in input value provides a per-primitive index to fragment shaders on supported hardware, similar to the existing vertex_index and instance_index built-ins. The primitive_index built-in variable is useful for advanced graphical techniques, such as virtualized geometry.

rg11b10ufloat-renderable

When enabled, allows RENDER_ATTACHMENT usage of rg11b10ufloat-format GPUTextures, as well as their blending and multisampling.

shader-f16

When enabled, allows the use of the half-precision floating-point type f16 in WGSL.

subgroups

When enabled, allows the use of subgroups in WGSL. Subgroups enable SIMD-level parallelism, allowing threads in a workgroup to communicate and execute collective math operations such as calculating sums, and share data efficiently across threads.

Note that the subgroupMinSize and subgroupMaxSize properties can be useful to check whether the adapter supports the subgroup size a hardcoded algorithm needs. You can use f16 values with subgroups when you request a GPUDevice with both the shader-f16 and subgroups features. When subgroups is enabled, it also allows the subgroup_id WGSL language feature to be used.

subgroup-size-control

When enabled, allows the use of subgroups and subgroup_size_control in WGSL (the subgroups feature is automatically enabled). This allows you to set the subgroup size of a compute pipeline using the @subgroup_size() attribute in WGSL compute shaders, which is beneficial for optimizing compute shader performance when using subgroup operations on specific platforms, such as for AI workloads. Subgroup size must be a power of 2 within the range of the adapter's subgroupMinSize and subgroupMaxSize, inclusive. See Subgroup size control for more information.

texture-component-swizzle

When enabled, allows the swizzle property to be set when calling GPUTexture.createView(). This lets a texture view rearrange or replace a texture's red, green, blue, and alpha channel values when a shader accesses it.

texture-compression-bc

When enabled, allows creation of two-dimensional BC compressed textures. If texture-compression-bc is enabled, the following values can be used for the format property of the createTexture() descriptor when creating a GPUTexture: bc1-rgba-unorm, bc1-rgba-unorm-srgb, bc2-rgba-unorm, bc2-rgba-unorm-srgb, bc3-rgba-unorm, bc3-rgba-unorm-srgb, bc4-r-unorm, bc4-r-snorm, bc5-rg-unorm, bc5-rg-snorm, bc6h-rgb-ufloat, bc6h-rgb-float, bc7-rgba-unorm, and bc7-rgba-unorm-srgb.

texture-compression-bc-sliced-3d

When enabled, allows creation of three-dimensional BC compressed textures. If texture-compression-bc-sliced-3d is enabled, texture-compression-bc is automatically enabled, as it enables using BC texture formats (see texture-compression-bc, above) in the first two dimensions. texture-compression-bc-sliced-3d enables using those same textures in the third dimension.

texture-compression-astc

When enabled, allows creation of two-dimensional ASTC compressed textures. If texture-compression-astc is enabled, the following values can be used for the format property of the createTexture() descriptor when creating a GPUTexture: astc-4x4-unorm, astc-4x4-unorm-srgb, astc-5x4-unorm, astc-5x4-unorm-srgb, astc-5x5-unorm, astc-5x5-unorm-srgb, astc-6x5-unorm, astc-6x5-unorm-srgb, astc-6x6-unorm, astc-6x6-unorm-srgb, astc-8x5-unorm, astc-8x5-unorm-srgb, astc-8x6-unorm, astc-8x6-unorm-srgb, astc-8x8-unorm, astc-8x8-unorm-srgb, astc-10x5-unorm, astc-10x5-unorm-srgb, astc-10x6-unorm, astc-10x6-unorm-srgb, astc-10x8-unorm, astc-10x8-unorm-srgb, astc-10x10-unorm, astc-10x10-unorm-srgb, astc-12x10-unorm, astc-12x10-unorm-srgb, astc-12x12-unorm, and astc-12x12-unorm-srgb.

texture-compression-astc-sliced-3d

When enabled, allows creation of three-dimensional ASTC compressed textures. If texture-compression-astc-sliced-3d is enabled, texture-compression-astc is automatically enabled, as it enables using ASTC texture formats (see texture-compression-astc, above) in the first two dimensions. texture-compression-astc-sliced-3d enables using those same textures in the third dimension.

texture-compression-etc2

When enabled, allows creation of two-dimensional ETC2 compressed textures. If texture-compression-etc2 is enabled, the following values can be used for the format property of the createTexture() descriptor when creating a GPUTexture: etc2-rgb8unorm, etc2-rgb8unorm-srgb, etc2-rgb8a1unorm, etc2-rgb8a1unorm-srgb, etc2-rgba8unorm, etc2-rgba8unorm-srgb, eac-r11unorm, eac-r11snorm, eac-rg11unorm, and eac-rg11snorm.

texture-formats-tier1

When enabled, automatically enables the rg11b10ufloat-renderable feature, and allows creation of GPUTextures (via GPUDevice.createTexture()) with the formats specified in Tier 1. The Tier 1 set of texture formats allows developers to port existing content to the web without rewriting it to fit the smaller set of texture formats that core WebGPU supports.

texture-formats-tier2

When enabled, automatically enables the rg11b10ufloat-renderable and texture-formats-tier1 features, and allows creation of GPUTextures (via GPUDevice.createTexture()) with the formats specified in Tier 2. The Tier 2 set of texture formats provides read-write storage access to additional texture formats, which is required for advanced usage.

timestamp-query

When enabled, allows timestamp queries to be run, which measure the time taken to run compute and render passes. If timestamp-query is enabled, the timestamp value can be set for the type property of the createQuerySet() descriptor when creating a GPUQuerySet. In addition, the timestampWrites property can be set on the beginComputePass() and beginRenderPass() descriptor when creating a GPUComputePassEncoder and GPURenderPassEncoder, respectively. GPUQuerySet objects are referenced within the objects included in the timestampWrites property, to specify where timestamps should be written to.

Instance properties

The following properties are available to all read-only Set-like objects (the links below are to the Set global object reference page).

size

Returns the number of values in the set.

Instance methods

The following methods are available to all read-only Set-like objects (the below links are to the Set global object reference page).

has()

Returns a boolean asserting whether an element is present with the given value in the set or not.

values()

Returns a new iterator object that yields the values for each element in the set in insertion order.

keys()

An alias for values().

entries()

Returns a new iterator object that contains an array of [value, value] for each element in the set, in insertion order.

forEach()

Calls a provided callback function once for each value present in the set, in insertion order.

Examples

js
async function init() {
  if (!navigator.gpu) {
    throw Error("WebGPU not supported.");
  }

  const adapter = await navigator.gpu.requestAdapter();
  if (!adapter) {
    throw Error("Couldn't request WebGPU adapter.");
  }

  const adapterFeatures = adapter.features;

  // Return the size of the set
  console.log(adapterFeatures.size);

  // Check whether a feature is supported by the adapter
  console.log(adapterFeatures.has("texture-compression-astc"));

  // Iterate through all the set values using values()
  const valueIterator = adapterFeatures.values();
  for (const value of valueIterator) {
    console.log(value);
  }

  // Iterate through all the set values using keys()
  const keyIterator = adapterFeatures.keys();
  for (const value of keyIterator) {
    console.log(value);
  }

  // Iterate through all the set values using entries()
  const entryIterator = adapterFeatures.entries();
  for (const entry of entryIterator) {
    console.log(entry[0]);
  }

  // Iterate through all the set values using forEach()
  adapterFeatures.forEach((value) => {
    console.log(value);
  });

  // …
}

Specifications

Specification
WebGPU
# gpusupportedfeatures

Browser compatibility

See also