/** * Measures how long the gpu spent on a frame, using timestamp queries written * around the render pass. * * Waiting on `onSubmittedWorkDone` would give the same answer and stop the cpu * from running ahead, which is the thing worth measuring in the first place. * These are read back a frame or more later instead, and a frame is skipped * while a previous read is still mapping, so the sample rate drops rather than * the frame rate. */ export declare class GpuTimer { private readonly querySet; private readonly resolveBuffer; private readonly readBuffer; private reading; /** Gpu time for the most recently measured frame, in milliseconds. */ lastMs: number; private constructor(); /** Null where the adapter does not offer timestamps, which is common. */ static create(device: GPUDevice): GpuTimer | null; /** Passed to beginRenderPass so the gpu stamps the pass boundaries. */ timestampWrites(): GPURenderPassTimestampWrites; /** Copies the stamps out, inside the frame's own encoder. */ resolve(encoder: GPUCommandEncoder): void; /** Reads the previous frame's stamps without blocking this one. */ sample(): void; destroy(): void; }