demo · v131

GPUCanvasContext.getConfiguration()

Libraries that share a canvas can now ask the canvas what the host already configured: format, alphaMode, colorSpace, usage. No more "what did the host pass to configure()?" guesswork.

configuration we passed

getConfiguration() returned

the api

const ctx = canvas.getContext("webgpu");
ctx.configure({ device, format, alphaMode: "premultiplied" });

const cfg = ctx.getConfiguration();
console.log(cfg.format, cfg.alphaMode, cfg.usage, cfg.colorSpace);

see also