playcanvas
Version:
Open-source WebGL/WebGPU 3D engine for the web
19 lines (17 loc) • 388 B
JavaScript
class GpuTimer {
get timings() {
this._timings[0] = this.device.gpuProfiler?._frameTime ?? 0;
return this._timings;
}
constructor(device){
this.device = device;
if (device.gpuProfiler) {
device.gpuProfiler.enabled = true;
}
this.enabled = true;
this.unitsName = 'ms';
this.decimalPlaces = 1;
this._timings = [];
}
}
export { GpuTimer };