diff options
| author | 3gg <3gg@shellblade.net> | 2026-02-08 18:29:34 -0800 |
|---|---|---|
| committer | 3gg <3gg@shellblade.net> | 2026-02-08 18:29:34 -0800 |
| commit | 27378f3537e9dbe0bfeb1ebb8a653e6050f2ea4a (patch) | |
| tree | 1b39e524d6c8fb75fac7f1dd597c44d1afce3de2 /include | |
| parent | 85a5ad70b7fa4844e37fe06463ea82d8e6f1abaf (diff) | |
Implement basic perf counters
Diffstat (limited to 'include')
| -rw-r--r-- | include/swgfx.h | 13 |
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 | |||
| 25 | typedef float R; | 27 | typedef float R; |
| 26 | 28 | ||
| 27 | typedef struct sgVec2i { int x, y; } sgVec2i; | 29 | typedef struct sgVec2i { int x, y; } sgVec2i; |
| @@ -66,6 +68,15 @@ typedef struct sgImage { | |||
| 66 | 68 | ||
| 67 | typedef struct swgfx swgfx; | 69 | typedef struct swgfx swgfx; |
| 68 | 70 | ||
| 71 | #if SWGFX_PROFILING | ||
| 72 | typedef 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 | |||
| 69 | size_t sgMem(int width, int height); // Get memory requirements. | 80 | size_t sgMem(int width, int height); // Get memory requirements. |
| 70 | swgfx* sgNew(int width, int height, void* mem); | 81 | swgfx* sgNew(int width, int height, void* mem); |
| 71 | void sgDel(swgfx**); | 82 | void sgDel(swgfx**); |
| @@ -98,4 +109,6 @@ void sgTrianglesIndexedNonUniform(swgfx*, size_t numTris, const sgTriIdx* tris, | |||
| 98 | void sgGamma (swgfx*, sgPixel*, int width, int height); | 109 | void sgGamma (swgfx*, sgPixel*, int width, int height); |
| 99 | void sgGammaInv(swgfx*, sgPixel*, int width, int height); | 110 | void sgGammaInv(swgfx*, sgPixel*, int width, int height); |
| 100 | 111 | ||
| 112 | sgCounters sgGetCounters(const swgfx*); | ||
| 113 | |||
| 101 | void sgCheck(swgfx*); | 114 | void sgCheck(swgfx*); |
