UNPKG

playcanvas

Version:

Open-source WebGL/WebGPU 3D engine for the web

20 lines (19 loc) 364 B
class GpuTimer { constructor(device) { this.device = device; if (device.gpuProfiler) { device.gpuProfiler.enabled = true; } this.enabled = true; this.unitsName = "ms"; this.decimalPlaces = 1; this._timings = []; } get timings() { this._timings[0] = this.device.gpuProfiler?._frameTime ?? 0; return this._timings; } } export { GpuTimer };