Change profile to compile time, but still allow enable or disabled
This commit is contained in:
parent
6cce79cfe6
commit
9793e1cfd9
20
GL/draw.c
20
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
|
||||
#include <kos.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#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
|
||||
|
|
|
@ -2,6 +2,14 @@
|
|||
|
||||
#include <stdint.h>
|
||||
|
||||
#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
|
||||
|
|
Loading…
Reference in New Issue
Block a user