GPU: wgslLanguageFeatures property

فهرست فصل‌ها دانلود آرشیوناشر

MDN Web Docs · نسخهٔ df622a2a1c1e · CC BY-SA 2.5 و مجوز جداگانهٔ ناشر برای نمونه‌کد

{{APIRef("WebGPU API")}}{{SecureContext_Header}}{{AvailableInWorkers}}

The **wgslLanguageFeatures** read-only property of the {{domxref("GPU")}} interface returns a {{domxref("WGSLLanguageFeatures")}} object that reports the WGSL language extensions supported by the WebGPU implementation.

توجه: 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 {{domxref("WGSLLanguageFeatures")}} object instance. This is a setlike object.

Examples

js
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

{{Specifications}}

Browser compatibility

{{Compat}}

See also

  • WebGPU API