canvaskit-wasm 0.39 build 2026-04-29

WebGPUCanvasOptions

Plain JS object for CK.MakeGPUCanvasContext — picks the swapchain texture format and how the canvas's alpha is interpreted on composite. Both fields are optional; sensible defaults from the WebGPU spec are used when omitted.

const ctx = CK.MakeGPUCanvasContext(deviceCtx, canvasEl, {
  format: 'bgra8unorm',     // matches navigator.gpu.getPreferredCanvasFormat() on most hardware
  alphaMode: 'premultiplied'
});

Fields

FieldTypeNotes
formatGPUTextureFormatSwapchain texture format. Match navigator.gpu.getPreferredCanvasFormat() for best perf.
alphaModeGPUCanvasAlphaMode'opaque' | 'premultiplied'. Controls how the canvas alpha composites with the page.

See also