playcanvas
Version:
PlayCanvas WebGL game engine
19 lines (17 loc) • 388 B
JavaScript
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 };