diff --git a/GL/flush.c b/GL/flush.c index 11518b3..40f0e91 100644 --- a/GL/flush.c +++ b/GL/flush.c @@ -123,9 +123,9 @@ void APIENTRY glKosSwapBuffers() { aligned_vector_clear(&PT_LIST.vector); aligned_vector_clear(&TR_LIST.vector); + #ifdef PROFILER_COMPILE PROFILER_CHECKPOINT("scene"); PROFILER_POP(); - #ifdef PROFILER_COMPILE if(frame_count++ > 100) { profiler_print_stats(); frame_count = 0; diff --git a/GL/lighting.c b/GL/lighting.c index 04d2a52..31eb9c1 100644 --- a/GL/lighting.c +++ b/GL/lighting.c @@ -7,7 +7,7 @@ static GLfloat SCENE_AMBIENT [] = {0.2, 0.2, 0.2, 1.0}; static GLboolean VIEWER_IN_EYE_COORDINATES = GL_TRUE; static GLenum COLOR_CONTROL = GL_SINGLE_COLOR; -static GLboolean TWO_SIDED_LIGHTING = GL_FALSE; +//static GLboolean TWO_SIDED_LIGHTING = GL_FALSE; static GLenum COLOR_MATERIAL_MODE = GL_AMBIENT_AND_DIFFUSE; static LightSource LIGHTS[MAX_LIGHTS]; diff --git a/GL/profiler.c b/GL/profiler.c index bc51cf0..8a0aebe 100644 --- a/GL/profiler.c +++ b/GL/profiler.c @@ -6,6 +6,8 @@ #include "profiler.h" #include "../containers/aligned_vector.h" +#ifdef PROFILER_COMPILE + #define MAX_PATH 256 typedef struct { @@ -126,7 +128,7 @@ void profiler_pop() { aligned_vector_resize(&root->stack, root->stack.size - 1); } - +#include void profiler_print_stats() { if(!PROFILER_ENABLED) return; @@ -138,6 +140,8 @@ void profiler_print_stats() { float ms = ((float) result->total_time_us) / 1000.0f; float avg = ms / (float) result->total_calls; - fprintf(stderr, "%-60s%-20f%-20f%u\n", result->name, avg, ms, result->total_calls); + fprintf(stderr, "%-60s%-20f%-20f%" PRIu64 "\n", result->name, (double)avg, (double)ms, result->total_calls); } } + +#endif diff --git a/GL/profiler.h b/GL/profiler.h index 113130f..fbc944b 100644 --- a/GL/profiler.h +++ b/GL/profiler.h @@ -2,6 +2,14 @@ #include +#define PROFILER_COMPILE 0 +#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,15 +21,6 @@ void profiler_checkpoint(const char* name); void profiler_pop(); void profiler_print_stats(); - -void profiler_enable(); -void profiler_disable(); - -#define PROFILER_COMPILE 0 -#ifdef PROFILER_COMPILE -#define PROFILER_PUSH(S) profiler_push(S) -#define PROFILER_CHECKPOINT(P) profiler_checkpoint(P) -#define PROFILER_POP() profiler_pop() #else #define PROFILER_PUSH(S) do {} while (0) #define PROFILER_CHECKPOINT(P) do {} while (0)