Vala プログラミング

WebGPU プログラミング

おなが@京都先端科学大

Chrome Stable WebGPU

2022/07/05/
chrome stable version 103
WebGPU: version 2022/05/13
WGSL: version 2022/04/11

chrome の安定版(現在のバージョンは 103)でも、WebGPU を利用できます。
WebGPU Samples https://austin-eng.com/webgpu-samples/
このサンプルでは、Next.js, Node.js などのライブラリを使用しています。

これらのライブラリを使用しないで、WebGPU を利用するには、コマンドラインから --enable-unsafe-webgpu を付けて起動します。(”chrome://flags" では表示されません。)
mac の例 open -a "Google Chrome" --args --enable-unsafe-webgpu

chrome canary と同様に、この時点では GPUDevice の読込みが不安定になっています。requestDevice の read error となる場合は、再読み込みや再起動を行います。

変更点

chrome 103 chrome canary 105
WebGPU
GPUTextureFormat
context.getPreferredFormat(adapter) navigator.gpu.getPreferredCanvasFormat()
context.configure()内
compositingAlphaMode: "premultiplied" alphaMode: "premultiplied"
WGSL
Pipeline Stage Attributes
@stage(vertex) @vertex
@stage(fragment) @frafment
@stage(compute) @compute