forked from playcanvas/engine
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstats.js
More file actions
100 lines (83 loc) · 2.34 KB
/
stats.js
File metadata and controls
100 lines (83 loc) · 2.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
import { getApplication } from './globals.js';
/**
* @private
* @class
* @name ApplicationStats
* @param {GraphicsDevice} device - The graphics device.
*/
class ApplicationStats {
constructor(device) {
this.frame = {
fps: 0,
ms: 0,
dt: 0,
updateStart: 0,
updateTime: 0,
renderStart: 0,
renderTime: 0,
physicsStart: 0,
physicsTime: 0,
cullTime: 0,
sortTime: 0,
skinTime: 0,
morphTime: 0,
instancingTime: 0, // deprecated
triangles: 0,
otherPrimitives: 0,
shaders: 0,
materials: 0,
cameras: 0,
shadowMapUpdates: 0,
shadowMapTime: 0,
depthMapTime: 0, // deprecated
forwardTime: 0,
lightClustersTime: 0,
lightClusters: 0,
_timeToCountFrames: 0,
_fpsAccum: 0
};
this.drawCalls = {
forward: 0,
depth: 0, // deprecated
shadow: 0,
immediate: 0, // deprecated
misc: 0, // everything that is not forward/depth/shadow (post effect quads etc)
total: 0, // total = forward + depth + shadow + misc
// Some of forward/depth/shadow/misc draw calls:
skinned: 0,
instanced: 0, // deprecated
removedByInstancing: 0 // deprecated
};
this.misc = {
renderTargetCreationTime: 0
};
this.particles = {
updatesPerFrame: 0,
_updatesPerFrame: 0,
frameTime: 0,
_frameTime: 0
};
this.shaders = device._shaderStats;
this.vram = device._vram;
Object.defineProperty(this.vram, 'totalUsed', {
get: function () {
return this.tex + this.vb + this.ib;
}
});
Object.defineProperty(this.vram, 'geom', {
get: function () {
return this.vb + this.ib;
}
});
}
get scene() {
return getApplication().scene._stats;
}
get lightmapper() {
return getApplication().lightmapper._stats;
}
get batcher() {
return getApplication().batcher._stats;
}
}
export { ApplicationStats };