diff --git a/GL/draw.c b/GL/draw.c index a2749dc..628ca46 100644 --- a/GL/draw.c +++ b/GL/draw.c @@ -1100,7 +1100,7 @@ static void submitVertices(GLenum mode, GLsizei first, GLsizei count, GLenum typ glActiveTextureARB(activeTexture); - profiler_push(__func__); + PROFILER_PUSH(__func__); PolyList* activeList = _glActivePolyList(); @@ -1117,19 +1117,19 @@ static void submitVertices(GLenum mode, GLsizei first, GLsizei count, GLenum typ * we use this startOffset to reset those pointers after clipping */ uint32_t startOffset = start - (ClipVertex*) activeList->vector.data; - profiler_checkpoint("allocate"); + PROFILER_CHECKPOINT("allocate"); generate(start, mode, first, count, (GLubyte*) indices, type, doTexture, doMultitexture, doLighting); - profiler_checkpoint("generate"); + PROFILER_CHECKPOINT("generate"); light(start, spaceNeeded); - profiler_checkpoint("light"); + PROFILER_CHECKPOINT("light"); transform(start, spaceNeeded); - profiler_checkpoint("transform"); + PROFILER_CHECKPOINT("transform"); if(_glIsClippingEnabled()) { @@ -1169,15 +1169,15 @@ static void submitVertices(GLenum mode, GLsizei first, GLsizei count, GLenum typ } - profiler_checkpoint("clip"); + PROFILER_CHECKPOINT("clip"); divide(start, spaceNeeded); - profiler_checkpoint("divide"); + PROFILER_CHECKPOINT("divide"); push(header, start, spaceNeeded, _glActivePolyList(), 0); - profiler_checkpoint("push"); + PROFILER_CHECKPOINT("push"); /* Now, if multitexturing is enabled, we want to send exactly the same vertices again, except: - We want to enable blending, and send them to the TR list @@ -1188,7 +1188,7 @@ static void submitVertices(GLenum mode, GLsizei first, GLsizei count, GLenum typ if(!doMultitexture) { /* Multitexture actively disabled */ - profiler_pop(); + PROFILER_POP(); return; } @@ -1196,7 +1196,7 @@ static void submitVertices(GLenum mode, GLsizei first, GLsizei count, GLenum typ if(!texture1 || ((ENABLED_VERTEX_ATTRIBUTES & ST_ENABLED_FLAG) != ST_ENABLED_FLAG)) { /* Multitexture implicitly disabled */ - profiler_pop(); + PROFILER_POP(); return; } diff --git a/GL/flush.c b/GL/flush.c index e5e5274..835e62a 100644 --- a/GL/flush.c +++ b/GL/flush.c @@ -124,7 +124,7 @@ void APIENTRY glKosSwapBuffers() { TRACE(); - profiler_push(__func__); + PROFILER_PUSH(__func__); pvr_wait_ready(); @@ -149,8 +149,8 @@ void APIENTRY glKosSwapBuffers() { aligned_vector_clear(&PT_LIST.vector); aligned_vector_clear(&TR_LIST.vector); - profiler_checkpoint("scene"); - profiler_pop(); + PROFILER_CHECKPOINT("scene"); + PROFILER_POP(); if(frame_count++ > 100) { profiler_print_stats(); diff --git a/GL/profiler.c b/GL/profiler.c index bc51cf0..d922b83 100644 --- a/GL/profiler.c +++ b/GL/profiler.c @@ -1,9 +1,11 @@ + #include #include #include #include #include "profiler.h" +#ifdef PROFILER_COMPILE #include "../containers/aligned_vector.h" #define MAX_PATH 256 @@ -24,7 +26,7 @@ typedef struct { static RootProfiler* root = NULL; -static char PROFILER_ENABLED = 0; +static char PROFILER_ENABLED = PROFILER_COMPILE; void profiler_enable() { PROFILER_ENABLED = 1; @@ -141,3 +143,4 @@ void profiler_print_stats() { fprintf(stderr, "%-60s%-20f%-20f%u\n", result->name, avg, ms, result->total_calls); } } +#endif diff --git a/GL/profiler.h b/GL/profiler.h index acaf8bf..f7a6ec4 100644 --- a/GL/profiler.h +++ b/GL/profiler.h @@ -2,6 +2,14 @@ #include +#define PROFILER_COMPILE 1 +#ifdef PROFILER_COMPILE +#define PROFILER_PUSH(S) profiler_push(S) +#define PROFILER_CHECKPOINT(P) profiler_checkpoint(P) +#define PROFILER_POP() profiler_pop() +void profiler_enable(); +void profiler_disable(); + typedef struct { char name[64]; uint64_t start_time_in_us; @@ -13,6 +21,8 @@ void profiler_checkpoint(const char* name); void profiler_pop(); void profiler_print_stats(); - -void profiler_enable(); -void profiler_disable(); +#else +#define PROFILER_PUSH(S) +#define PROFILER_CHECKPOINT(P) +#define PROFILER_POP() +#endif