VisuTwin Canvas
C++ 3D Engine — Metal Backend
Loading...
Searching...
No Matches
applicationStats.h
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0
2// Copyright 2025-2026 Arnis Lektauers
3//
4// Created by Arnis Lektauers on 11.10.2025.
5//
6#pragma once
7
9
10namespace visutwin::canvas
11{
15 struct FrameStats {
16 float fps = 0.0f;
17 float ms = 0.0f;
18 float dt = 0.0f;
19
20 double updateStart = 0.0;
21 double updateTime = 0.0;
22 double fixedUpdateTime = 0.0;
23 double renderStart = 0.0;
24 double renderTime = 0.0;
25 double physicsStart = 0.0;
26 double physicsTime = 0.0;
27 double cullTime = 0.0;
28 double sortTime = 0.0;
29 double skinTime = 0.0;
30 double morphTime = 0.0;
31 double instancingTime = 0.0; // deprecated
32
33 int triangles = 0;
34 int gsplats = 0;
36 int shaders = 0;
37 int materials = 0;
38 int cameras = 0;
40 double shadowMapTime = 0.0;
41 double depthMapTime = 0.0; // deprecated
42 double forwardTime = 0.0;
43
44 double lightClustersTime = 0.0;
46
47 double timeToCountFrames = 0.0;
48 int fpsAccum = 0;
49 };
50
55 int forward = 0;
56 int depth = 0; // deprecated
57 int shadow = 0;
58 int immediate = 0; // deprecated
59 int misc = 0; // everything that is not forward/depth/shadow (post effect quads etc)
60 int total = 0; // total = forward + depth + shadow + misc
61
62 // Some of the forward/depth/shadow/misc draw calls:
63 int skinned = 0;
64 int instanced = 0; // deprecated
65
66 int removedByInstancing = 0; // deprecated
67 };
68
75 double frameTime = 0.0;
76 double _frameTime = 0.0;
77 };
78
79 struct MiscStats {
81 };
82
87 {
88 public:
89 ApplicationStats(std::shared_ptr<GraphicsDevice> _graphicsDevice) {}
90
91 DrawCallStats& drawCalls() { return _drawCalls; }
92
93 FrameStats& frame() { return _frame; }
94
95 ParticleStats& particles() { return _particles; }
96
97 MiscStats& misc() { return _misc; }
98
99 void setFrameStats(double now, float dt, float ms);
100
101 private:
102 DrawCallStats _drawCalls;
103
104 ParticleStats _particles;
105
106 FrameStats _frame;
107
108 MiscStats _misc;
109 };
110}
void setFrameStats(double now, float dt, float ms)
ApplicationStats(std::shared_ptr< GraphicsDevice > _graphicsDevice)