Optimisations
This commit is contained in:
parent
8101e43e90
commit
d9539da841
25
GL/draw.c
25
GL/draw.c
|
@ -501,13 +501,12 @@ static inline void transformNormalToEyeSpace(GLfloat* normal) {
|
||||||
mat_trans_normal3(normal[0], normal[1], normal[2]);
|
mat_trans_normal3(normal[0], normal[1], normal[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void swapVertex(ClipVertex* v1, ClipVertex* v2) {
|
#define swapVertex(a, b) \
|
||||||
static ClipVertex tmp;
|
do { \
|
||||||
|
ClipVertex temp = *a; \
|
||||||
tmp = *v1;
|
*a = *b; \
|
||||||
*v1 = *v2;
|
*b = temp; \
|
||||||
*v2 = tmp;
|
} while(0)
|
||||||
}
|
|
||||||
|
|
||||||
static inline FloatParseFunc _calcVertexParseFunc() {
|
static inline FloatParseFunc _calcVertexParseFunc() {
|
||||||
switch(VERTEX_POINTER.type) {
|
switch(VERTEX_POINTER.type) {
|
||||||
|
@ -850,15 +849,17 @@ static inline void genArraysTriangles(ClipVertex* output, GLuint count) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void genArraysQuads(ClipVertex* output, GLuint count) {
|
static inline void genArraysQuads(ClipVertex* output, GLuint count) {
|
||||||
GLsizei i = 3;
|
ClipVertex* previous;
|
||||||
|
ClipVertex* this = output + 3;
|
||||||
|
|
||||||
for(; i < count; i += 4) {
|
const ClipVertex* end = output + count;
|
||||||
ClipVertex* this = output + i;
|
|
||||||
ClipVertex* previous = output + (i - 1);
|
|
||||||
|
|
||||||
|
while(this < end) {
|
||||||
|
previous = this - 1;
|
||||||
swapVertex(previous, this);
|
swapVertex(previous, this);
|
||||||
this->flags = PVR_CMD_VERTEX_EOL;
|
this->flags = PVR_CMD_VERTEX_EOL;
|
||||||
|
this += 4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -92,6 +92,7 @@ void APIENTRY glColor3fv(const GLfloat* v) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void APIENTRY glVertex3f(GLfloat x, GLfloat y, GLfloat z) {
|
void APIENTRY glVertex3f(GLfloat x, GLfloat y, GLfloat z) {
|
||||||
|
aligned_vector_reserve(&VERTICES, VERTICES.size + 3);
|
||||||
aligned_vector_push_back(&VERTICES, &x, 1);
|
aligned_vector_push_back(&VERTICES, &x, 1);
|
||||||
aligned_vector_push_back(&VERTICES, &y, 1);
|
aligned_vector_push_back(&VERTICES, &y, 1);
|
||||||
aligned_vector_push_back(&VERTICES, &z, 1);
|
aligned_vector_push_back(&VERTICES, &z, 1);
|
||||||
|
|
|
@ -138,6 +138,6 @@ void profiler_print_stats() {
|
||||||
float ms = ((float) result->total_time_us) / 1000.0f;
|
float ms = ((float) result->total_time_us) / 1000.0f;
|
||||||
float avg = ms / (float) result->total_calls;
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user