GPU: wgslLanguageFeatures property

Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

The wgslLanguageFeatures read-only property of the GPU interface returns a WGSLLanguageFeatures object that reports the WGSL language extensions supported by the WebGPU implementation.

Note: Not all WGSL language extensions are available to WebGPU in all browsers that support the API. We recommend you thoroughly test any extensions you choose to use.

Value

A WGSLLanguageFeatures object instance. This is a setlike object.

Examples

js

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

  const wgslFeatures = navigator.gpu.wgslLanguageFeatures;

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

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

  // ...
}

Specifications

Specification
WebGPU
# dom-gpu-wgsllanguagefeatures

Browser compatibility

BCD tables only load in the browser

See also