Navigator: gpu プロパティ
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Experimental: これは実験的な機能です。
本番で使用する前にブラウザー互換性一覧表をチェックしてください。
Navigator.gpu は読み取り専用のプロパティで、 WebGPU API のエントリーポイントである現在の閲覧コンテキストの GPU オブジェクトを返します。
値
GPU オブジェクトです。
例
js
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 device = await adapter.requestDevice(); //... } 仕様書
| Specification |
|---|
| WebGPU> # navigator-gpu> |