Skip to content

Documentation / spryte / GpuTimer

Interface: GpuTimer ​

Defined in: gpu-timer.ts:4

GPU time for the work submitted between begin() and end(), read a few frames later. See gpuTimer.

Properties ​

ms ​

readonly ms: number | undefined

Defined in: gpu-timer.ts:11

Smoothed GPU milliseconds per begin()/end() pair, or undefined until a result arrives, when timing isn't supported, and after a context loss or a GPU timing glitch (a "disjoint" event) until new results come.


supported ​

readonly supported: boolean

Defined in: gpu-timer.ts:6

Whether this browser and backend can time the GPU (WebGL2 with EXT_disjoint_timer_query_webgl2).

Methods ​

begin() ​

begin(): void

Defined in: gpu-timer.ts:13

Start timing. Call before draw.begin() to time the whole frame.

Returns ​

void


dispose() ​

dispose(): void

Defined in: gpu-timer.ts:17

Free the GPU queries.

Returns ​

void


end() ​

end(): void

Defined in: gpu-timer.ts:15

Stop timing, and collect any results the GPU has finished. Call after draw.end().

Returns ​

void