demo · v131

configure() → getConfiguration() round-trip

Pick a format, alphaMode, colorSpace, and toneMapping. Call configure(), then call getConfiguration() and confirm every field comes back exactly. This is the inspection API libraries use to verify the host page's choices.

canvas (configured)

device: —

getConfiguration() response

click configure

the api

const adapter = await navigator.gpu.requestAdapter();
const device = await adapter.requestDevice();
const ctx = canvas.getContext("webgpu");
ctx.configure({ device, format: "rgba8unorm", alphaMode: "opaque" });

const config = ctx.getConfiguration();
// { device, format, usage, viewFormats, colorSpace, toneMapping, alphaMode }

see also