UNPKG

playcanvas

Version:

PlayCanvas WebGL game engine

66 lines (65 loc) 1.61 kB
/** * Base class of a simple GPU profiler. * * @ignore */ export class GpuProfiler { /** * Profiling slots allocated for the current frame, storing the names of the slots. * * @type {string[]} * @ignore */ frameAllocations: string[]; /** * Map of past frame allocations, indexed by renderVersion * * @type {Map<number, string[]>} * @ignore */ pastFrameAllocations: Map<number, string[]>; /** * True if enabled in the current frame. * * @private */ private _enabled; /** * The enable request for the next frame. * * @private */ private _enableRequest; /** * The time it took to render the last frame on GPU, or 0 if the profiler is not enabled. * * @private */ private _frameTime; loseContext(): void; /** * True to enable the profiler. * * @type {boolean} */ set enabled(value: boolean); get enabled(): boolean; processEnableRequest(): void; request(renderVersion: any): void; report(renderVersion: any, timings: any): void; /** * Allocate a slot for GPU timing during the frame. This slot is valid only for the current * frame. This allows multiple timers to be used during the frame, each with a unique name. * * @param {string} name - The name of the slot. * @returns {number} The assigned slot index. * @ignore */ getSlot(name: string): number; /** * Number of slots allocated during the frame. * * @ignore */ get slotCount(): number; }