1 |
- {"ast":null,"code":"import { PerfCounter } from \"../Misc/perfCounter.js\";\n/**\n * This class can be used to get instrumentation data from a Babylon engine\n * @see https://doc.babylonjs.com/features/featuresDeepDive/scene/optimize_your_scene#engineinstrumentation\n */\nexport class EngineInstrumentation {\n // Properties\n /**\n * Gets the perf counter used for GPU frame time\n */\n get gpuFrameTimeCounter() {\n return this.engine.getGPUFrameTimeCounter();\n }\n /**\n * Gets the GPU frame time capture status\n */\n get captureGPUFrameTime() {\n return this._captureGPUFrameTime;\n }\n /**\n * Enable or disable the GPU frame time capture\n */\n set captureGPUFrameTime(value) {\n if (value === this._captureGPUFrameTime) {\n return;\n }\n this._captureGPUFrameTime = value;\n this.engine.captureGPUFrameTime(value);\n }\n /**\n * Gets the perf counter used for shader compilation time\n */\n get shaderCompilationTimeCounter() {\n return this._shaderCompilationTime;\n }\n /**\n * Gets the shader compilation time capture status\n */\n get captureShaderCompilationTime() {\n return this._captureShaderCompilationTime;\n }\n /**\n * Enable or disable the shader compilation time capture\n */\n set captureShaderCompilationTime(value) {\n if (value === this._captureShaderCompilationTime) {\n return;\n }\n this._captureShaderCompilationTime = value;\n if (value) {\n this._onBeforeShaderCompilationObserver = this.engine.onBeforeShaderCompilationObservable.add(() => {\n this._shaderCompilationTime.fetchNewFrame();\n this._shaderCompilationTime.beginMonitoring();\n });\n this._onAfterShaderCompilationObserver = this.engine.onAfterShaderCompilationObservable.add(() => {\n this._shaderCompilationTime.endMonitoring();\n });\n } else {\n this.engine.onBeforeShaderCompilationObservable.remove(this._onBeforeShaderCompilationObserver);\n this._onBeforeShaderCompilationObserver = null;\n this.engine.onAfterShaderCompilationObservable.remove(this._onAfterShaderCompilationObserver);\n this._onAfterShaderCompilationObserver = null;\n }\n }\n /**\n * Instantiates a new engine instrumentation.\n * This class can be used to get instrumentation data from a Babylon engine\n * @see https://doc.babylonjs.com/features/featuresDeepDive/scene/optimize_your_scene#engineinstrumentation\n * @param engine Defines the engine to instrument\n */\n constructor(\n /**\n * Define the instrumented engine.\n */\n engine) {\n this.engine = engine;\n this._captureGPUFrameTime = false;\n this._captureShaderCompilationTime = false;\n this._shaderCompilationTime = new PerfCounter();\n // Observers\n this._onBeginFrameObserver = null;\n this._onEndFrameObserver = null;\n this._onBeforeShaderCompilationObserver = null;\n this._onAfterShaderCompilationObserver = null;\n }\n /**\n * Dispose and release associated resources.\n */\n dispose() {\n this.engine.onBeginFrameObservable.remove(this._onBeginFrameObserver);\n this._onBeginFrameObserver = null;\n this.engine.onEndFrameObservable.remove(this._onEndFrameObserver);\n this._onEndFrameObserver = null;\n this.engine.onBeforeShaderCompilationObservable.remove(this._onBeforeShaderCompilationObserver);\n this._onBeforeShaderCompilationObserver = null;\n this.engine.onAfterShaderCompilationObservable.remove(this._onAfterShaderCompilationObserver);\n this._onAfterShaderCompilationObserver = null;\n this.engine = null;\n }\n}","map":{"version":3,"names":["PerfCounter","EngineInstrumentation","gpuFrameTimeCounter","engine","getGPUFrameTimeCounter","captureGPUFrameTime","_captureGPUFrameTime","value","shaderCompilationTimeCounter","_shaderCompilationTime","captureShaderCompilationTime","_captureShaderCompilationTime","_onBeforeShaderCompilationObserver","onBeforeShaderCompilationObservable","add","fetchNewFrame","beginMonitoring","_onAfterShaderCompilationObserver","onAfterShaderCompilationObservable","endMonitoring","remove","constructor","_onBeginFrameObserver","_onEndFrameObserver","dispose","onBeginFrameObservable","onEndFrameObservable"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/Instrumentation/engineInstrumentation.js"],"sourcesContent":["import { PerfCounter } from \"../Misc/perfCounter.js\";\n/**\n * This class can be used to get instrumentation data from a Babylon engine\n * @see https://doc.babylonjs.com/features/featuresDeepDive/scene/optimize_your_scene#engineinstrumentation\n */\nexport class EngineInstrumentation {\n // Properties\n /**\n * Gets the perf counter used for GPU frame time\n */\n get gpuFrameTimeCounter() {\n return this.engine.getGPUFrameTimeCounter();\n }\n /**\n * Gets the GPU frame time capture status\n */\n get captureGPUFrameTime() {\n return this._captureGPUFrameTime;\n }\n /**\n * Enable or disable the GPU frame time capture\n */\n set captureGPUFrameTime(value) {\n if (value === this._captureGPUFrameTime) {\n return;\n }\n this._captureGPUFrameTime = value;\n this.engine.captureGPUFrameTime(value);\n }\n /**\n * Gets the perf counter used for shader compilation time\n */\n get shaderCompilationTimeCounter() {\n return this._shaderCompilationTime;\n }\n /**\n * Gets the shader compilation time capture status\n */\n get captureShaderCompilationTime() {\n return this._captureShaderCompilationTime;\n }\n /**\n * Enable or disable the shader compilation time capture\n */\n set captureShaderCompilationTime(value) {\n if (value === this._captureShaderCompilationTime) {\n return;\n }\n this._captureShaderCompilationTime = value;\n if (value) {\n this._onBeforeShaderCompilationObserver = this.engine.onBeforeShaderCompilationObservable.add(() => {\n this._shaderCompilationTime.fetchNewFrame();\n this._shaderCompilationTime.beginMonitoring();\n });\n this._onAfterShaderCompilationObserver = this.engine.onAfterShaderCompilationObservable.add(() => {\n this._shaderCompilationTime.endMonitoring();\n });\n }\n else {\n this.engine.onBeforeShaderCompilationObservable.remove(this._onBeforeShaderCompilationObserver);\n this._onBeforeShaderCompilationObserver = null;\n this.engine.onAfterShaderCompilationObservable.remove(this._onAfterShaderCompilationObserver);\n this._onAfterShaderCompilationObserver = null;\n }\n }\n /**\n * Instantiates a new engine instrumentation.\n * This class can be used to get instrumentation data from a Babylon engine\n * @see https://doc.babylonjs.com/features/featuresDeepDive/scene/optimize_your_scene#engineinstrumentation\n * @param engine Defines the engine to instrument\n */\n constructor(\n /**\n * Define the instrumented engine.\n */\n engine) {\n this.engine = engine;\n this._captureGPUFrameTime = false;\n this._captureShaderCompilationTime = false;\n this._shaderCompilationTime = new PerfCounter();\n // Observers\n this._onBeginFrameObserver = null;\n this._onEndFrameObserver = null;\n this._onBeforeShaderCompilationObserver = null;\n this._onAfterShaderCompilationObserver = null;\n }\n /**\n * Dispose and release associated resources.\n */\n dispose() {\n this.engine.onBeginFrameObservable.remove(this._onBeginFrameObserver);\n this._onBeginFrameObserver = null;\n this.engine.onEndFrameObservable.remove(this._onEndFrameObserver);\n this._onEndFrameObserver = null;\n this.engine.onBeforeShaderCompilationObservable.remove(this._onBeforeShaderCompilationObserver);\n this._onBeforeShaderCompilationObserver = null;\n this.engine.onAfterShaderCompilationObservable.remove(this._onAfterShaderCompilationObserver);\n this._onAfterShaderCompilationObserver = null;\n this.engine = null;\n }\n}\n"],"mappings":"AAAA,SAASA,WAAW,QAAQ,wBAAwB;AACpD;AACA;AACA;AACA;AACA,OAAO,MAAMC,qBAAqB,CAAC;EAC/B;EACA;AACJ;AACA;EACI,IAAIC,mBAAmBA,CAAA,EAAG;IACtB,OAAO,IAAI,CAACC,MAAM,CAACC,sBAAsB,CAAC,CAAC;EAC/C;EACA;AACJ;AACA;EACI,IAAIC,mBAAmBA,CAAA,EAAG;IACtB,OAAO,IAAI,CAACC,oBAAoB;EACpC;EACA;AACJ;AACA;EACI,IAAID,mBAAmBA,CAACE,KAAK,EAAE;IAC3B,IAAIA,KAAK,KAAK,IAAI,CAACD,oBAAoB,EAAE;MACrC;IACJ;IACA,IAAI,CAACA,oBAAoB,GAAGC,KAAK;IACjC,IAAI,CAACJ,MAAM,CAACE,mBAAmB,CAACE,KAAK,CAAC;EAC1C;EACA;AACJ;AACA;EACI,IAAIC,4BAA4BA,CAAA,EAAG;IAC/B,OAAO,IAAI,CAACC,sBAAsB;EACtC;EACA;AACJ;AACA;EACI,IAAIC,4BAA4BA,CAAA,EAAG;IAC/B,OAAO,IAAI,CAACC,6BAA6B;EAC7C;EACA;AACJ;AACA;EACI,IAAID,4BAA4BA,CAACH,KAAK,EAAE;IACpC,IAAIA,KAAK,KAAK,IAAI,CAACI,6BAA6B,EAAE;MAC9C;IACJ;IACA,IAAI,CAACA,6BAA6B,GAAGJ,KAAK;IAC1C,IAAIA,KAAK,EAAE;MACP,IAAI,CAACK,kCAAkC,GAAG,IAAI,CAACT,MAAM,CAACU,mCAAmC,CAACC,GAAG,CAAC,MAAM;QAChG,IAAI,CAACL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,GAAG,IAAI;IAC/B,IAAI,CAACpB,MAAM,CAACU,mCAAmC,CAACO,MAAM,CAAC,IAAI,CAACR,kCAAkC,CAAC;IAC/F,IAAI,CAACA,kCAAkC,GAAG,IAAI;IAC9C,IAAI,CAACT,MAAM,CAACe,kCAAkC,CAACE,MAAM,CAAC,IAAI,CAACH,iCAAiC,CAAC;IAC7F,IAAI,CAACA,iCAAiC,GAAG,IAAI;IAC7C,IAAI,CAACd,MAAM,GAAG,IAAI;EACtB;AACJ","ignoreList":[]},"metadata":{},"sourceType":"module","externalDependencies":[]}
|