Cogs.Core
AssetInstanceData.h
1#pragma once
2
3#include "Base.h"
4
5#include "Foundation/Platform/Timer.h"
6
7namespace Cogs::Core
8{
9 // Cost tracking cost in some tests 10% of entire frame time, and currently
10 // it has no effect as min and max scaling is always 1.
11 //
12 //#define ENABLE_COST_TRACKING 1
13
14
16 {
17 ~TimingScope() { *time = t.elapsedSeconds(); }
18 Timer t;
19 double * time;
20 };
21
23 {
24 Timer timer;
25
26 TimingScope startInit() { return { timer.startNew(), &initTime }; }
27 TimingScope startProcessing() { return { timer.startNew(), &processingTime }; }
28 TimingScope startLodCalculation() { return { timer.startNew(), &lodTime }; }
29 TimingScope startUpdate() { return { timer.startNew(), &updateTime }; }
30 TimingScope startDispatch() { return { timer.startNew(), &dispatchTime }; }
31 TimingScope startCostCalculation() { return { timer.startNew(), &calculateCostTime }; }
32
33 double initTime = 0;
34 double processingTime = 0;
35 double estimateTime = 0;
36 double lodTime = 0;
37 double updateTime = 0;
38 double calculateCostTime = 0;
39 double dispatchTime = 0;
40
41 uint32_t spawnedEntities = 0;
42 uint32_t destroyedEntities = 0;
43
44 uint32_t lodsEvaluated = 0;
45 uint32_t lodChanges = 0;
46
47 uint32_t modelsRequested = 0;
48 };
49
51 {
52 uint64_t memory = 0;
53 uint32_t drawCalls = 0;
54 uint32_t primitiveCount = 0;
55
56 AssetGpuStats & operator+=(const AssetGpuStats & other)
57 {
58 memory += other.memory;
59 drawCalls += other.drawCalls;
60 primitiveCount += other.primitiveCount;
61 return *this;
62 }
63 };
64
66 {
67#if ENABLE_COST_TRACKING
68 AssetGpuStats max;
69 AssetGpuStats current;
70 AssetGpuStats projected;
71#endif
72
73 AssetInstanceFrameStats frameLimits;
75
76 uint32_t numEntities = 0;
77 uint32_t numRequests = 0;
78
79 uint32_t frustumCullIn = 0;
80 uint32_t frustumCullOut = 0;
81 uint32_t bboxCullOut = 0;
82
83#if ENABLE_COST_TRACKING
84 float toleranceScale = 1.f;
85 float toleranceScaleMin = 1.0f;
86 float toleranceScaleMax = 1.0f;
87 float toleranceScaleIncrement = 0.01f;
88#endif
89 };
90}
Old timer class.
Definition: Timer.h:37
Contains the Engine, Renderer, resource managers and other systems needed to run Cogs....