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
90 lines (75 loc) · 1.93 KB
/
stats.js
File metadata and controls
90 lines (75 loc) · 1.93 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
/**
* @private
* @constructor
*/
pc.ApplicationStats = function(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,
triangles: 0,
otherPrimitives: 0,
shaders: 0,
materials: 0,
cameras: 0,
shadowMapUpdates: 0,
shadowMapTime: 0,
depthMapTime: 0,
forwardTime: 0,
_timeToCountFrames: 0,
_fpsAccum: 0
};
this.drawCalls = {
forward: 0,
depth: 0,
shadow: 0,
immediate: 0,
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,
removedByInstancing: 0
};
this.misc = {
renderTargetCreationTime: 0
};
this.particles = {
updatesPerFrame: 0, _updatesPerFrame: 0,
frameTime: 0, _frameTime: 0
};
this.vram = device._vram;
this.shaders = device._shaderStats;
Object.defineProperty(this.vram, 'totalUsed', {
get: function() {
return this.tex + this.vb + this.ib;
}
});
Object.defineProperty(this, 'scene', {
get: function() {
return pc.Application._currentApplication.scene._stats;
}
});
Object.defineProperty(this, 'lightmapper', {
get: function() {
return pc.Application._currentApplication.lightmapper._stats;
}
});
Object.defineProperty(this, 'batcher', {
get: function() {
return pc.Application._currentApplication.batcher._stats;
}
});
pc.events.attach(this);
};