Documentation
    Preparing search index...

    Interface WebgpuCanvas

    The drawing surface, described by what this backend touches — the twin of WebglCanvas, and narrowed at runtime by WebgpuRenderer.initialize for the same reason (RendererOptions.canvas is unknown by design).

    There is no addEventListener here, and its absence is the interesting half: WebGL 2 signals loss through two canvas events, while WebGPU signals it through GpuDevice.lost, a promise on the device. The surface therefore needs no event target at all, which is why an OffscreenCanvas satisfies this interface with nothing added.

    interface WebgpuCanvas {
        height: number;
        width: number;
        getContext(contextId: "webgpu"): unknown;
    }
    Index
    height: number

    Swap-chain height in device pixels. Written by resize.

    width: number

    Swap-chain width in device pixels. Written by resize.

    • Acquires the "webgpu" context. Typed to return unknown because this package does not name GPUCanvasContext; the result is validated structurally before use.

      Parameters

      • contextId: "webgpu"

      Returns unknown