UNPKG

typegpu

Version:

A thin layer between JS and WebGPU/WGSL that improves development experience and allows for faster iteration.

33 lines (32 loc) 1.82 kB
import { type TgpuQuerySet } from '../querySet/querySet.ts'; import type { ExperimentalTgpuRoot } from '../root/rootTypes.ts'; import type { TgpuCommandEncoder } from '../commandEncoder/commandEncoder.ts'; export interface Timeable { /** * Attaches a callback reporting the GPU-side start and end timestamps of the pipeline's pass. * Repeated executions within one command encoder write to the same query set indices, * so the callback fires once, with the timestamps of the last execution. */ withPerformanceCallback(callback: (start: bigint, end: bigint) => void | Promise<void>): this; withTimestampWrites(options: { querySet: TgpuQuerySet<'timestamp'> | GPUQuerySet; beginningOfPassWriteIndex?: number; endOfPassWriteIndex?: number; }): this; } export type TimestampWritesPriors = { readonly timestampWrites?: { querySet: TgpuQuerySet<'timestamp'> | GPUQuerySet; beginningOfPassWriteIndex?: number; endOfPassWriteIndex?: number; }; readonly performanceCallback?: (start: bigint, end: bigint) => void | Promise<void>; }; export declare function createWithPerformanceCallback<T extends TimestampWritesPriors>(currentPriors: T, callback: (start: bigint, end: bigint) => void | Promise<void>, querySet: TgpuQuerySet<'timestamp'>): T; export declare function createWithTimestampWrites<T extends TimestampWritesPriors>(currentPriors: T, options: { querySet: TgpuQuerySet<'timestamp'> | GPUQuerySet; beginningOfPassWriteIndex?: number; endOfPassWriteIndex?: number; }, root: ExperimentalTgpuRoot): T; /** Returns false when the encoder is one we cannot defer work to, meaning the callback never fires */ export declare function queueTimestampResolve(encoder: TgpuCommandEncoder, priors: TimestampWritesPriors): boolean;