WGSLLanguageFeatures

Limited availability

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

Experimental: これは実験的な機能です。
本番で使用する前にブラウザー互換性一覧表をチェックしてください。

WebGPU APIWGSLLanguageFeatures インターフェイスは、この WebGPU の実装が対応している WGSL 言語の拡張を報告する Set 風オブジェクトです。

WGSLLanguageFeatures オブジェクトは GPU.wgslLanguageFeatures プロパティ経由で参照します。

メモ: API をサポートしているすべてのブラウザーの WebGPU ですべての WGSL 言語の拡張が使えるわけではありません。使うことにした拡張をすべて徹底的にテストすることを推奨します。

利用可能な機能

利用可能な WGSL 言語の拡張は実装や物理デバイスによって異なる可能性があり、時間の経過によっても変わる可能性があります。そのため、ここでは列挙しません。完全なリストは、WGSL の仕様書内の WGSL 言語の拡張を参照してください。

インスタンスプロパティ

以下のプロパティは、すべての読み取り専用の Set 風オブジェクトで使用可能です。

size Experimental

集合に含まれる値の数を返します。

インスタンスメソッド

以下のメソッドは、すべての読み取り専用の Set 風オブジェクトで使用可能です。

has() Experimental

指定の値の要素が集合に含まれるか否かを表す論理値を返します。

values() Experimental

集合内の各要素の を挿入した順に出力する新しいイテレーターオブジェクトを返します。

keys() Experimental

values() の別名です。

entries() Experimental

集合内の各要素に対応する 配列 [value, value] が挿入した順に含まれる新しいイテレーターオブジェクトを返します。

forEach() Experimental

集合内の各要素について挿入した順に指定のコールバック関数を 1 度ずつ呼び出します。

js
if (!navigator.gpu) {
  throw Error("WebGPU に対応していません。");
}

const wgslFeatures = navigator.gpu.wgslLanguageFeatures;

// 集合のサイズを返す
console.log(wgslFeatures.size);

// values() を用いて集合のすべての値を走査する
const valueIterator = wgslFeatures.values();
for (const value of valueIterator) {
  console.log(value);
}

// ...

仕様書

Specification
WebGPU
# gpuwgsllanguagefeatures

ブラウザーの互換性

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
WGSLLanguageFeatures
Experimental
[Symbol.iterator]
Experimental
entries
Experimental
packed_4x8_integer_dot_product extension
Experimental
readonly_and_readwrite_storage_textures extension
Experimental
unrestricted_pointer_parameters extension
Experimental
forEach
Experimental
has
Experimental
keys
Experimental
size
Experimental
values
Experimental

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
In development. Supported in a pre-release version.
In development. Supported in a pre-release version.
No support
No support
Experimental. Expect behavior to change in the future.
See implementation notes.

関連情報