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_BINDINGusageofbgra8unorm-formatGPUTextures. clip-distances-
When enabled, allows the use of
clip_distancesin WGSL. core-features-and-limits-
When enabled, signifies that the
GPUAdapter/GPUDeviceis 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 thecore-features-and-limitsfeature enabled, and therefore support core WebGPU. To create a "compatibility mode" adapter, specify afeatureLevelvalue ofcompatibilityin yourGPU.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-limitswill 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-controlis enabled, theunclippedDepthproperty is available on theprimitiveobject included as part of thecreateRenderPipeline()orcreateRenderPipelineAsync()descriptor when creating aGPURenderPipeline.primitivedescribes how a pipeline constructs and rasterizes primitives from its vertex inputs. SetunclippedDepthtotrueto disable depth-clipping. depth32float-stencil8-
When enabled, allows creation of textures with the format
depth32float-stencil8. Ifdepth32float-stencil8is enabled, thedepth32float-stencil8value can be used for theformatproperty of thecreateTexture()descriptor when creating aGPUTexture. dual-source-blending-
When enabled, allows the use of
dual_source_blendingin 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-blendingenables the following blend factor operations (specified in thedstFactorandsrcFactorproperties ofcreateRenderPipeline()andcreateRenderPipelineAsync()descriptors):src1,one-minus-src1,src1-alpha, andone-minus-src1-alpha. float32-blendable-
When enabled, allows blending of
GPUTextures that use ther32float,rg32float, orrgba32floatformat. float32-filterable-
When enabled, allows filtering of
GPUTextures that use ther32float,rg32float, orrgba32floatformat. indirect-first-instance-
When enabled, allows the use of non-zero
firstInstancevalues in theindirectBufferproperty of thedrawIndirect()anddrawIndexedIndirect()methods available onGPURenderPassEncoderandGPURenderBundleEncoderinstances. primitive-index-
When enabled, allows the use of the
primitive_indexbuilt-in variable in WGSL. This built-in input value provides a per-primitive index to fragment shaders on supported hardware, similar to the existingvertex_indexandinstance_indexbuilt-ins. Theprimitive_indexbuilt-in variable is useful for advanced graphical techniques, such as virtualized geometry. rg11b10ufloat-renderable-
When enabled, allows
RENDER_ATTACHMENTusageofrg11b10ufloat-formatGPUTextures, as well as their blending and multisampling. shader-f16-
When enabled, allows the use of the half-precision floating-point type
f16in WGSL. subgroups-
When enabled, allows the use of
subgroupsin 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
subgroupMinSizeandsubgroupMaxSizeproperties 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 theshader-f16andsubgroupsfeatures. Whensubgroupsis enabled, it also allows thesubgroup_idWGSL language feature to be used. subgroup-size-control-
When enabled, allows the use of
subgroupsandsubgroup_size_controlin WGSL (thesubgroupsfeature 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'ssubgroupMinSizeandsubgroupMaxSize, inclusive. See Subgroup size control for more information. texture-component-swizzle-
When enabled, allows the
swizzleproperty to be set when callingGPUTexture.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-bcis enabled, the following values can be used for theformatproperty of thecreateTexture()descriptor when creating aGPUTexture: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, andbc7-rgba-unorm-srgb. texture-compression-bc-sliced-3d-
When enabled, allows creation of three-dimensional BC compressed textures. If
texture-compression-bc-sliced-3dis enabled,texture-compression-bcis automatically enabled, as it enables using BC texture formats (seetexture-compression-bc, above) in the first two dimensions.texture-compression-bc-sliced-3denables using those same textures in the third dimension. texture-compression-astc-
When enabled, allows creation of two-dimensional ASTC compressed textures. If
texture-compression-astcis enabled, the following values can be used for theformatproperty of thecreateTexture()descriptor when creating aGPUTexture: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, andastc-12x12-unorm-srgb. texture-compression-astc-sliced-3d-
When enabled, allows creation of three-dimensional ASTC compressed textures. If
texture-compression-astc-sliced-3dis enabled,texture-compression-astcis automatically enabled, as it enables using ASTC texture formats (seetexture-compression-astc, above) in the first two dimensions.texture-compression-astc-sliced-3denables using those same textures in the third dimension. texture-compression-etc2-
When enabled, allows creation of two-dimensional ETC2 compressed textures. If
texture-compression-etc2is enabled, the following values can be used for theformatproperty of thecreateTexture()descriptor when creating aGPUTexture:etc2-rgb8unorm,etc2-rgb8unorm-srgb,etc2-rgb8a1unorm,etc2-rgb8a1unorm-srgb,etc2-rgba8unorm,etc2-rgba8unorm-srgb,eac-r11unorm,eac-r11snorm,eac-rg11unorm, andeac-rg11snorm. texture-formats-tier1-
When enabled, automatically enables the
rg11b10ufloat-renderablefeature, and allows creation ofGPUTextures (viaGPUDevice.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-renderableandtexture-formats-tier1features, and allows creation ofGPUTextures (viaGPUDevice.createTexture()) with the formats specified in Tier 2. The Tier 2 set of texture formats providesread-writestorage 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-queryis enabled, thetimestampvalue can be set for thetypeproperty of thecreateQuerySet()descriptor when creating aGPUQuerySet. In addition, thetimestampWritesproperty can be set on thebeginComputePass()andbeginRenderPass()descriptor when creating aGPUComputePassEncoderandGPURenderPassEncoder, respectively.GPUQuerySetobjects are referenced within the objects included in thetimestampWritesproperty, 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
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
- The WebGPU API
- The specification Feature Index