Merge pull request #11228 from Pokechu22/statistics-macros

VideoCommon/Statistics: Require semicolons after statistics macros
This commit is contained in:
Admiral H. Curtiss 2022-11-04 23:15:52 +01:00 committed by GitHub
commit 26b68f1f84
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 31 additions and 10 deletions

View File

@ -287,11 +287,11 @@ static void ClipLine(int* indices)
void ProcessTriangle(OutputVertexData* v0, OutputVertexData* v1, OutputVertexData* v2) void ProcessTriangle(OutputVertexData* v0, OutputVertexData* v1, OutputVertexData* v2)
{ {
INCSTAT(g_stats.this_frame.num_triangles_in) INCSTAT(g_stats.this_frame.num_triangles_in);
if (IsTriviallyRejected(v0, v1, v2)) if (IsTriviallyRejected(v0, v1, v2))
{ {
INCSTAT(g_stats.this_frame.num_triangles_rejected) INCSTAT(g_stats.this_frame.num_triangles_rejected);
// NOTE: The slope used by zfreeze shouldn't be updated if the triangle is // NOTE: The slope used by zfreeze shouldn't be updated if the triangle is
// trivially rejected during clipping // trivially rejected during clipping
return; return;
@ -308,7 +308,7 @@ void ProcessTriangle(OutputVertexData* v0, OutputVertexData* v1, OutputVertexDat
PerspectiveDivide(v1); PerspectiveDivide(v1);
PerspectiveDivide(v2); PerspectiveDivide(v2);
Rasterizer::UpdateZSlope(v0, v1, v2, bpmem.scissorOffset.x * 2, bpmem.scissorOffset.y * 2); Rasterizer::UpdateZSlope(v0, v1, v2, bpmem.scissorOffset.x * 2, bpmem.scissorOffset.y * 2);
INCSTAT(g_stats.this_frame.num_triangles_culled) INCSTAT(g_stats.this_frame.num_triangles_culled);
return; return;
} }
} }
@ -321,7 +321,7 @@ void ProcessTriangle(OutputVertexData* v0, OutputVertexData* v1, OutputVertexDat
PerspectiveDivide(v2); PerspectiveDivide(v2);
PerspectiveDivide(v1); PerspectiveDivide(v1);
Rasterizer::UpdateZSlope(v0, v2, v1, bpmem.scissorOffset.x * 2, bpmem.scissorOffset.y * 2); Rasterizer::UpdateZSlope(v0, v2, v1, bpmem.scissorOffset.x * 2, bpmem.scissorOffset.y * 2);
INCSTAT(g_stats.this_frame.num_triangles_culled) INCSTAT(g_stats.this_frame.num_triangles_culled);
return; return;
} }
} }

View File

@ -90,11 +90,32 @@ extern Statistics g_stats;
#define STATISTICS #define STATISTICS
#ifdef STATISTICS #ifdef STATISTICS
#define INCSTAT(a) (a)++; #define INCSTAT(a) \
#define ADDSTAT(a, b) (a) += (b); do \
#define SETSTAT(a, x) (a) = (int)(x); { \
(a)++; \
} while (false)
#define ADDSTAT(a, b) \
do \
{ \
(a) += (b); \
} while (false)
#define SETSTAT(a, x) \
do \
{ \
(a) = static_cast<int>(x); \
} while (false)
#else #else
#define INCSTAT(a) ; #define INCSTAT(a) \
#define ADDSTAT(a, b) ; do \
#define SETSTAT(a, x) ; { \
} while (false)
#define ADDSTAT(a, b) \
do \
{ \
} while (false)
#define SETSTAT(a, x) \
do \
{ \
} while (false)
#endif #endif