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]);
|
||||
}
|
||||
|
||||
static inline void swapVertex(ClipVertex* v1, ClipVertex* v2) {
|
||||
static ClipVertex tmp;
|
||||
|
||||
tmp = *v1;
|
||||
*v1 = *v2;
|
||||
*v2 = tmp;
|
||||
}
|
||||
#define swapVertex(a, b) \
|
||||
do { \
|
||||
ClipVertex temp = *a; \
|
||||
*a = *b; \
|
||||
*b = temp; \
|
||||
} while(0)
|
||||
|
||||
static inline FloatParseFunc _calcVertexParseFunc() {
|
||||
switch(VERTEX_POINTER.type) {
|
||||
|
@ -850,15 +849,17 @@ static inline void genArraysTriangles(ClipVertex* output, GLuint count) {
|
|||
}
|
||||
}
|
||||
|
||||
static void genArraysQuads(ClipVertex* output, GLuint count) {
|
||||
GLsizei i = 3;
|
||||
static inline void genArraysQuads(ClipVertex* output, GLuint count) {
|
||||
ClipVertex* previous;
|
||||
ClipVertex* this = output + 3;
|
||||
|
||||
for(; i < count; i += 4) {
|
||||
ClipVertex* this = output + i;
|
||||
ClipVertex* previous = output + (i - 1);
|
||||
const ClipVertex* end = output + count;
|
||||
|
||||
while(this < end) {
|
||||
previous = this - 1;
|
||||
swapVertex(previous, this);
|
||||
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) {
|
||||
aligned_vector_reserve(&VERTICES, VERTICES.size + 3);
|
||||
aligned_vector_push_back(&VERTICES, &x, 1);
|
||||
aligned_vector_push_back(&VERTICES, &y, 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 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