diff options
Diffstat (limited to 'debug.h')
-rw-r--r-- | debug.h | 34 |
1 files changed, 29 insertions, 5 deletions
@@ -15,6 +15,10 @@ union debugval { int32 i; }; +enum PerfID { + perf_renderframe +}; + // things that get cleared every frame with the UI struct debug_temp { @@ -28,16 +32,22 @@ struct project_debug { debug_temp Temp; bool32 ToggleWindow; + uint64 PixelCountTransparent; + uint64 PixelCountRendered; + uint64 PixelCountChecked; + // NOTE(fox): Pixel count isn't thread safe; don't use with multithreading! + uint64 LayerCycleCount[64]; }; static project_debug Debug; -#if ARM -#define DEBUG_CycleCountStart(ID) -#define DEBUG_CycleCountEnd(ID) + +#if DEBUG +#define Debug_CycleCountStart(ID) Debug.CycleCount[ID] = __rdtsc(); +#define Debug_CycleCountEnd(ID) Debug.EndCycleCount[ID] += __rdtsc() - Debug.CycleCount[ID]; Debug.ExecutionAmount[ID]++; #else -#define DEBUG_CycleCountStart(ID) Debug.CycleCount[ID] = __rdtsc(); -#define DEBUG_CycleCountEnd(ID) Debug.EndCycleCount[ID] += __rdtsc() - Debug.CycleCount[ID]; Debug.ExecutionAmount[ID]++; +#define Debug_CycleCountStart(ID) +#define Debug_CycleCountEnd(ID) #endif static void @@ -80,3 +90,17 @@ DebugWatchVar(char *Name, void *Address, valtype Type) { } #endif +#ifdef PERF + +struct perf_stats +{ + uint64 PixelCountTransparent; + uint64 PixelCountRendered; + uint64 PixelCountChecked; +}; + +static perf_stats Perf; +static uint64 Test; + +#endif + |