@galacean/effects-plugin-stats 0.0.0-experimental-20250512
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +22 -0
- package/README.md +1 -0
- package/dist/core.d.ts +45 -0
- package/dist/hooks/drawcall-hook.d.ts +20 -0
- package/dist/hooks/program-hook.d.ts +15 -0
- package/dist/hooks/shader-hook.d.ts +16 -0
- package/dist/hooks/texture-hook.d.ts +16 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +763 -0
- package/dist/index.js.map +1 -0
- package/dist/index.min.js +8 -0
- package/dist/index.min.js.map +1 -0
- package/dist/index.mjs +739 -0
- package/dist/index.mjs.map +1 -0
- package/dist/monitor.d.ts +31 -0
- package/dist/stats-component.d.ts +12 -0
- package/dist/stats.d.ts +37 -0
- package/package.json +43 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT LICENSE
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2019-present Ant Group Co., Ltd. https://www.antgroup.com/
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
a copy of this software and associated documentation files (the
|
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
11
|
+
the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be
|
|
14
|
+
included in all copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Galacean Effects Stats
|
package/dist/core.d.ts
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
interface Performance {
|
|
3
|
+
memory: any;
|
|
4
|
+
}
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Hook gl to calculate stats
|
|
8
|
+
*/
|
|
9
|
+
export declare class Core {
|
|
10
|
+
private readonly gl;
|
|
11
|
+
private drawCallHook;
|
|
12
|
+
private textureHook;
|
|
13
|
+
private shaderHook;
|
|
14
|
+
private samplingFrames;
|
|
15
|
+
private samplingIndex;
|
|
16
|
+
private updateCounter;
|
|
17
|
+
private updateTime;
|
|
18
|
+
private programHook;
|
|
19
|
+
constructor(gl: WebGLRenderingContext | WebGL2RenderingContext, debug?: boolean);
|
|
20
|
+
private hook;
|
|
21
|
+
/**
|
|
22
|
+
* reset draw call hook
|
|
23
|
+
*/
|
|
24
|
+
reset(): void;
|
|
25
|
+
/**
|
|
26
|
+
* release hook
|
|
27
|
+
*/
|
|
28
|
+
release(): void;
|
|
29
|
+
/**
|
|
30
|
+
* update performance data
|
|
31
|
+
*/
|
|
32
|
+
update(dt: number): PerformanceData | undefined;
|
|
33
|
+
}
|
|
34
|
+
export interface PerformanceData {
|
|
35
|
+
fps: number;
|
|
36
|
+
memory: number;
|
|
37
|
+
drawCall: number;
|
|
38
|
+
triangles: number;
|
|
39
|
+
lines: number;
|
|
40
|
+
points: number;
|
|
41
|
+
textures: number;
|
|
42
|
+
shaders: number;
|
|
43
|
+
webglContext: string;
|
|
44
|
+
programs: number;
|
|
45
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DrawCallHook
|
|
3
|
+
*/
|
|
4
|
+
export default class DrawCallHook {
|
|
5
|
+
private readonly gl;
|
|
6
|
+
private readonly debug;
|
|
7
|
+
drawCall: number;
|
|
8
|
+
triangles: number;
|
|
9
|
+
lines: number;
|
|
10
|
+
points: number;
|
|
11
|
+
private hooked;
|
|
12
|
+
private readonly realDrawElements;
|
|
13
|
+
private readonly realDrawArrays;
|
|
14
|
+
constructor(gl: WebGLRenderingContext | WebGL2RenderingContext, debug: boolean);
|
|
15
|
+
private hookedDrawElements;
|
|
16
|
+
private hookedDrawArrays;
|
|
17
|
+
private update;
|
|
18
|
+
reset(): void;
|
|
19
|
+
release(): void;
|
|
20
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ProgramHook
|
|
3
|
+
* 每一帧的 shader 数量
|
|
4
|
+
*/
|
|
5
|
+
export default class ProgramHook {
|
|
6
|
+
private readonly gl;
|
|
7
|
+
private readonly debug;
|
|
8
|
+
programs: number;
|
|
9
|
+
private readonly realUseProgram;
|
|
10
|
+
private hooked;
|
|
11
|
+
constructor(gl: WebGLRenderingContext | WebGL2RenderingContext, debug: boolean);
|
|
12
|
+
private hookedUseProgram;
|
|
13
|
+
reset(): void;
|
|
14
|
+
release(): void;
|
|
15
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ShaderHook
|
|
3
|
+
*/
|
|
4
|
+
export default class ShaderHook {
|
|
5
|
+
private readonly gl;
|
|
6
|
+
private readonly debug;
|
|
7
|
+
shaders: number;
|
|
8
|
+
private readonly realAttachShader;
|
|
9
|
+
private readonly realDetachShader;
|
|
10
|
+
private hooked;
|
|
11
|
+
constructor(gl: WebGLRenderingContext | WebGL2RenderingContext, debug: boolean);
|
|
12
|
+
private hookedAttachShader;
|
|
13
|
+
private hookedDetachShader;
|
|
14
|
+
reset(): void;
|
|
15
|
+
release(): void;
|
|
16
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TextureHook
|
|
3
|
+
*/
|
|
4
|
+
export default class TextureHook {
|
|
5
|
+
private readonly gl;
|
|
6
|
+
private readonly debug;
|
|
7
|
+
textures: number;
|
|
8
|
+
private readonly realCreateTexture;
|
|
9
|
+
private readonly realDeleteTexture;
|
|
10
|
+
private hooked;
|
|
11
|
+
constructor(gl: WebGLRenderingContext | WebGL2RenderingContext, debug: boolean);
|
|
12
|
+
private hookedCreateTexture;
|
|
13
|
+
private hookedDeleteTexture;
|
|
14
|
+
reset(): void;
|
|
15
|
+
release(): void;
|
|
16
|
+
}
|