@galacean/effects-plugin-stats 2.0.0-alpha.32

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 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);
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,19 @@
1
+ /**
2
+ * DrawCallHook
3
+ */
4
+ export default class DrawCallHook {
5
+ private readonly gl;
6
+ drawCall: number;
7
+ triangles: number;
8
+ lines: number;
9
+ points: number;
10
+ private hooked;
11
+ private readonly realDrawElements;
12
+ private readonly realDrawArrays;
13
+ constructor(gl: WebGLRenderingContext | WebGL2RenderingContext);
14
+ private hookedDrawElements;
15
+ private hookedDrawArrays;
16
+ private update;
17
+ reset(): void;
18
+ release(): void;
19
+ }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * ProgramHook
3
+ * 每一帧的 shader 数量
4
+ */
5
+ export default class ProgramHook {
6
+ private readonly gl;
7
+ programs: number;
8
+ private readonly realUseProgram;
9
+ private hooked;
10
+ constructor(gl: WebGLRenderingContext | WebGL2RenderingContext);
11
+ private hookedUseProgram;
12
+ reset(): void;
13
+ release(): void;
14
+ }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * ShaderHook
3
+ */
4
+ export default class ShaderHook {
5
+ private readonly gl;
6
+ shaders: number;
7
+ private readonly realAttachShader;
8
+ private readonly realDetachShader;
9
+ private hooked;
10
+ constructor(gl: WebGLRenderingContext | WebGL2RenderingContext);
11
+ private hookedAttachShader;
12
+ private hookedDetachShader;
13
+ reset(): void;
14
+ release(): void;
15
+ }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * TextureHook
3
+ */
4
+ export default class TextureHook {
5
+ private readonly gl;
6
+ textures: number;
7
+ private readonly realCreateTexture;
8
+ private readonly realDeleteTexture;
9
+ private hooked;
10
+ constructor(gl: WebGLRenderingContext | WebGL2RenderingContext);
11
+ private hookedCreateTexture;
12
+ private hookedDeleteTexture;
13
+ reset(): void;
14
+ release(): void;
15
+ }
@@ -0,0 +1 @@
1
+ export * from './stats';