summaryrefslogtreecommitdiff
path: root/include/swgfx.h
diff options
context:
space:
mode:
author3gg <3gg@shellblade.net>2026-02-08 18:29:34 -0800
committer3gg <3gg@shellblade.net>2026-02-08 18:29:34 -0800
commit27378f3537e9dbe0bfeb1ebb8a653e6050f2ea4a (patch)
tree1b39e524d6c8fb75fac7f1dd597c44d1afce3de2 /include/swgfx.h
parent85a5ad70b7fa4844e37fe06463ea82d8e6f1abaf (diff)
Implement basic perf counters
Diffstat (limited to 'include/swgfx.h')
-rw-r--r--include/swgfx.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/swgfx.h b/include/swgfx.h
index 9c3361d..72164b1 100644
--- a/include/swgfx.h
+++ b/include/swgfx.h
@@ -22,6 +22,8 @@ Multi-threading:
22#include <stddef.h> 22#include <stddef.h>
23#include <stdint.h> 23#include <stdint.h>
24 24
25#define SWGFX_PROFILING 1 // TODO: Move this to client project cmake.
26
25typedef float R; 27typedef float R;
26 28
27typedef struct sgVec2i { int x, y; } sgVec2i; 29typedef struct sgVec2i { int x, y; } sgVec2i;
@@ -66,6 +68,15 @@ typedef struct sgImage {
66 68
67typedef struct swgfx swgfx; 69typedef struct swgfx swgfx;
68 70
71#if SWGFX_PROFILING
72typedef struct sgCounters {
73 uint64_t frames; // Frames drawn.
74 uint64_t triangles3; // 3D triangles processed.
75 uint64_t triangles2; // 2D triangles processed.
76 uint64_t pixels; // Pixels written.
77} sgCounters;
78#endif // SWGFX_PROFILING
79
69size_t sgMem(int width, int height); // Get memory requirements. 80size_t sgMem(int width, int height); // Get memory requirements.
70swgfx* sgNew(int width, int height, void* mem); 81swgfx* sgNew(int width, int height, void* mem);
71void sgDel(swgfx**); 82void sgDel(swgfx**);
@@ -98,4 +109,6 @@ void sgTrianglesIndexedNonUniform(swgfx*, size_t numTris, const sgTriIdx* tris,
98void sgGamma (swgfx*, sgPixel*, int width, int height); 109void sgGamma (swgfx*, sgPixel*, int width, int height);
99void sgGammaInv(swgfx*, sgPixel*, int width, int height); 110void sgGammaInv(swgfx*, sgPixel*, int width, int height);
100 111
112sgCounters sgGetCounters(const swgfx*);
113
101void sgCheck(swgfx*); 114void sgCheck(swgfx*);