Limited availability
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.
You should note that not all features will be available to WebGPU in all browsers that support it, even if the features are supported by the underlying hardware. This could be due to constraints in the underlying system, browser, or adapter. For example:
If you are hoping to take advantage of a specific additional feature in a WebGPU app, thorough testing is advised.
Available featuresThe 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.
Feature name Descriptionbgra8unorm-storage
When enabled, allows STORAGE_BINDING
usage
of bgra8unorm
-format
GPUTexture
s. clip-distances
When enabled, allows the use of clip_distances
in WGSL. depth-clip-control
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 unclipped-depth
to true
to disable depth-clipping. depth32float-stencil8
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 r32float
-, rg32float
-, and rgba32float
-format
GPUTexture
s. float32-filterable
When enabled, allows filtering of r32float
-, rg32float
-, and rgba32float
-format
GPUTexture
s. 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. rg11b10ufloat-renderable
When enabled, allows RENDER_ATTACHMENT
usage
of rg11b10ufloat
-format
GPUTexture
s, 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 a sum of numbers, and offering an efficient method for cross-thread data sharing. Note that the subgroupMinSize
and subgroupMaxSize
properties can be useful to check if, for example, you have a hardcoded algorithm that requires a subgroup of a certain size. You can use f16 values with subgroups when you request a GPUDevice with both the shader-f16
and subgroups
features. texture-compression-bc
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
Allows creation of three-dimensional BC compressed textures. If texture-compression-bc-sliced-3d
is enabled, texture-compression-bc
must also be enabled, as it enables the BC texture formats to be used (see texture-compression-bc
, above) in the first two dimensions. texture-compression-bc-sliced-3d
enables those same textures to be used in the third dimension. Adapters that support texture-compression-bc
always support texture-compression-bc-sliced-3d
. Note that this feature is not currently supported in any browser. texture-compression-astc
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
, and astc-12x12-unorm``astc-12x12-unorm-srgb
. texture-compression-astc-sliced-3d
Allows creation of three-dimensional ASTC compressed textures. If texture-compression-astc-sliced-3d
is enabled, texture-compression-astc
must also be enabled, as it enables the ASTC texture formats to be used (see texture-compression-astc
, above) in the first two dimensions. texture-compression-astc-sliced-3d
enables those same textures to be used in the third dimension. Adapters that support texture-compression-astc
do not always support texture-compression-astc-sliced-3d
. Note that this feature is not currently supported in any browser. texture-compression-etc2
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
. timestamp-query
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.
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.
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 Browser compatibility See also
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4