blob: 4a6891e3011b7dde1ae3e9d09fe8b71e40080fab (
plain)
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
|
#if DEBUG
global_variable int32 *debugnull = NULL;
#define Assert(Expression) if(!(Expression)) {*debugnull = 21;}
enum valtype {
d_float,
d_uint,
d_int
};
union debugval {
real32 f;
uint32 u;
int32 i;
};
struct project_debug
{
uint32 Markers[8];
uint32 MarkerIndex = 0;
uint64 CycleCount[8];
uint64 EndCycleCount[8];
uint64 ExecutionAmount[8];
valtype DebugPropertyType[6];
debugval Val[6];
char *String[6];
uint32 WatchedProperties;
bool32 ToggleWindow;
bool32 ToggleRenders;
};
global_variable project_debug Debug;
#if ARM
#define DEBUG_CycleCountStart(ID)
#define DEBUG_CycleCountEnd(ID)
#else
#define DEBUG_CycleCountStart(ID) Debug.CycleCount[ID] = __rdtsc();
#define DEBUG_CycleCountEnd(ID) Debug.EndCycleCount[ID] += __rdtsc() - Debug.CycleCount[ID]; Debug.ExecutionAmount[ID]++;
#endif
internal void
DebugWatchVar(char *Name, void *Address, valtype Type) {
uint32 i = Debug.WatchedProperties;
Debug.String[i] = Name;
if (Type == d_float)
Debug.Val[i].f = *(real32 *)Address;
if (Type == d_uint)
Debug.Val[i].u = *(uint32 *)Address;
if (Type == d_int)
Debug.Val[i].i = *(int32 *)Address;
Debug.DebugPropertyType[i] = Type;
Debug.WatchedProperties++;
}
#else
#define Assert(Expression)
enum valtype {
};
union debugval {
};
struct project_debug
{
};
#define DEBUG_CycleCountStart(ID)
#define DEBUG_CycleCountEnd(ID)
internal void
DebugWatchVar(char *Name, void *Address, valtype Type) {
}
#endif
|