WebGPU initialization requires requesting an adapter then a device in two async steps
WebGPU initialization follows a two-step async handshake. First, call navigator.gpu.requestAdapter() to get a GPUAdapter — the API’s representation of a specific piece of GPU hardware. Then call adapter.requestDevice() to get the GPUDevice, the main interface for all GPU interaction. Both return promises and should be awaited. The adapter may be null if the hardware lacks required capabilities; always null-check. Check navigator.gpu first to detect browser support. Requesting with default options is appropriate for most uses; advanced options let you request high-performance vs low-power hardware on multi-GPU devices.
Examples
if (!navigator.gpu) throw new Error('WebGPU not supported');
const adapter = await navigator.gpu.requestAdapter();
if (!adapter) throw new Error('No GPUAdapter found');
const device = await adapter.requestDevice();
Assessment
From memory, write the two async calls needed to get a GPUDevice. Name the two null checks required and explain why each can fail.