@animech-public/playcanvas
Version:
PlayCanvas WebGL game engine
2 lines (1 loc) • 748 B
JavaScript
import{GpuProfiler as e}from"../gpu-profiler.js";import{WebgpuQuerySet as t}from"./webgpu-query-set.js";class s extends e{constructor(e){super(),this.device=void 0,this.frameGPUMarkerSlot=void 0,this.device=e,this.timestampQueriesSet=e.supportsTimestampQuery?new t(e,!0,512):null}destroy(){var e;null==(e=this.timestampQueriesSet)||e.destroy(),this.timestampQueriesSet=null}frameStart(){this.processEnableRequest()}frameEnd(){var e;this._enabled&&(null==(e=this.timestampQueriesSet)||e.resolve(2*this.slotCount))}request(){if(this._enabled){var e;const t=this.device.renderVersion;null==(e=this.timestampQueriesSet)||e.request(this.slotCount,t).then((e=>{this.report(e.renderVersion,e.timings)})),super.request(t)}}}export{s as WebgpuGpuProfiler};