GPUAdapter はブラウザが選んだ GPU と、利用できる機能・上限を表します。そこから GPUDevice を取得し、バッファやパイプラインを作成して GPU へコマンドを送ります。
const canvas = document.querySelector<HTMLCanvasElement>("#gpu-canvas");
if (!canvas) throw new Error("Canvas が見つかりません");
const adapter: GPUAdapter | null = await navigator.gpu.requestAdapter();
if (!adapter) throw new Error("GPU が見つかりません");
const device: GPUDevice = await adapter.requestDevice();
const context = canvas.getContext("webgpu");
if (!context) throw new Error("WebGPU context を作成できません");
const format: GPUTextureFormat = navigator.gpu.getPreferredCanvasFormat();
context.configure({ device, format } satisfies GPUCanvasConfiguration);
Adapter選択された GPU と利用可能な機能Deviceリソース作成とコマンド送信ContextCanvas の描画先