import { type Renderer } from "./renderer"; import { type ScrubFrame } from "./scrub-cursor"; export declare class WebGpuRenderer implements Renderer { private readonly canvas; private readonly device; private readonly context; private readonly format; private readonly pipeline; private readonly sampler; private readonly rotationBuffer; readonly name: "webgpu"; private texture; private bindGroup; private textureWidth; private textureHeight; /** Lazily built the first time a sample frame is drawn and import is * available; never built on the canvas-only path. */ private externalPipeline; private directImport; /** The 2D surface a decoded frame is converted through, built on first use. */ private conversion; /** What the rotation uniform currently holds, so an unturned source pays no * buffer write per frame. */ private uvRotation; private constructor(); /** Cheap pre-check before the async create(): is the API even present? */ static isSupported(): boolean; /** Acquires a device and configures the canvas. Throws if WebGPU is unusable. */ static create(canvas: OffscreenCanvas): Promise; draw(frame: ScrubFrame): void; /** * Points the shader's sampling at the turn this frame's pixels still owe. * Queue writes and submits run in order, so the value a pass reads is the one * written before it was encoded. */ private setUvRotation; dispose(): void; /** Zero-copy: wrap the VideoFrame as an external texture, sample it, submit, * then close the transient VideoFrame. The external texture is valid only * for this task, so the bind group is rebuilt every frame. */ private drawExternal; /** Draws the frame through a 2D canvas and uploads that, which is the * conversion the cache blits and the 2D renderer already go through. The * canvas is the display size, or its transpose on a quarter turn, so the * downscale happens once here and the shader only has to turn and stretch. */ private drawConverted; private conversionFor; /** * Renders one frame through both routes into offscreen targets and compares * what came out, which decides whether later frames are painted by importing * them directly. Reading the result back costs a round-trip to the GPU, so it * happens once and the frames drawn meanwhile take the converted route. */ private measureDirectImport; private drawCanvas; private renderPass; private encodePass; private ensureExternalPipeline; /** (Re)allocates the sampled texture and bind group when the size changes. */ private ensureTexture; }