summaryrefslogtreecommitdiff
path: root/debug.h
diff options
context:
space:
mode:
authorFox Caminiti <fox@foxcam.net>2022-08-18 23:11:29 -0400
committerFox Caminiti <fox@foxcam.net>2022-08-18 23:11:29 -0400
commit8c5f06c37f3c267ecd8f867cd49765c366b5f47c (patch)
treef8ec31daa1e050c0f5205d32cebe68ce5df65f6f /debug.h
parent9062e0aae9f2f576b7a237c28028aa6b09feee5e (diff)
many additions
Diffstat (limited to 'debug.h')
-rw-r--r--debug.h34
1 files changed, 29 insertions, 5 deletions
diff --git a/debug.h b/debug.h
index e2df239..5863298 100644
--- a/debug.h
+++ b/debug.h
@@ -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
+