Minor optimisations
This commit is contained in:
parent
02b4b2d438
commit
47d3c0f478
41
GL/draw.c
41
GL/draw.c
|
@ -214,14 +214,13 @@ static void generate(AlignedVector* output, const GLenum mode, const GLsizei fir
|
||||||
_parseColour((uint32_t*) &vertex->argb, cptr + (idx * cstride), DIFFUSE_POINTER.size, DIFFUSE_POINTER.type);
|
_parseColour((uint32_t*) &vertex->argb, cptr + (idx * cstride), DIFFUSE_POINTER.size, DIFFUSE_POINTER.type);
|
||||||
} else {
|
} else {
|
||||||
/* Default to white if colours are disabled */
|
/* Default to white if colours are disabled */
|
||||||
vertex->argb.a = 255;
|
*((uint32_t*) &vertex->argb) = ~0;
|
||||||
vertex->argb.r = 255;
|
|
||||||
vertex->argb.g = 255;
|
|
||||||
vertex->argb.b = 255;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ENABLED_VERTEX_ATTRIBUTES & UV_ENABLED_FLAG) {
|
if(ENABLED_VERTEX_ATTRIBUTES & UV_ENABLED_FLAG) {
|
||||||
_parseFloats(vertex->uv, uvptr + (idx * uvstride), UV_POINTER.size, UV_POINTER.type);
|
_parseFloats(vertex->uv, uvptr + (idx * uvstride), UV_POINTER.size, UV_POINTER.type);
|
||||||
|
} else {
|
||||||
|
vertex->uv[0] = vertex->uv[1] = 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ENABLED_VERTEX_ATTRIBUTES & NORMAL_ENABLED_FLAG) {
|
if(ENABLED_VERTEX_ATTRIBUTES & NORMAL_ENABLED_FLAG) {
|
||||||
|
@ -232,13 +231,21 @@ static void generate(AlignedVector* output, const GLenum mode, const GLsizei fir
|
||||||
vertex->nxyz[2] = -1.0f;
|
vertex->nxyz[2] = -1.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
if((mode == GL_TRIANGLES) && ((i + 1) % 3) == 0) {
|
switch(mode) {
|
||||||
vertex->flags = PVR_CMD_VERTEX_EOL;
|
case GL_TRIANGLES: {
|
||||||
} else if((mode == GL_QUADS) && ((i + 1) % 4) == 0) {
|
if(((i + 1) % 3) == 0) {
|
||||||
ClipVertex* previous = vertex - 1;
|
vertex->flags = PVR_CMD_VERTEX_EOL;
|
||||||
previous->flags = PVR_CMD_VERTEX_EOL;
|
}
|
||||||
swapVertex(previous, vertex);
|
} break;
|
||||||
} else if((mode == GL_POLYGON || mode == GL_TRIANGLE_FAN)) {
|
case GL_QUADS: {
|
||||||
|
if(((i + 1) % 4) == 0) {
|
||||||
|
ClipVertex* previous = vertex - 1;
|
||||||
|
previous->flags = PVR_CMD_VERTEX_EOL;
|
||||||
|
swapVertex(previous, vertex);
|
||||||
|
}
|
||||||
|
} break;
|
||||||
|
case GL_POLYGON:
|
||||||
|
case GL_TRIANGLE_FAN: {
|
||||||
ClipVertex* previous = vertex - 1;
|
ClipVertex* previous = vertex - 1;
|
||||||
if(i == 2) {
|
if(i == 2) {
|
||||||
swapVertex(previous, vertex);
|
swapVertex(previous, vertex);
|
||||||
|
@ -257,9 +264,15 @@ static void generate(AlignedVector* output, const GLenum mode, const GLsizei fir
|
||||||
|
|
||||||
vertex->flags = PVR_CMD_VERTEX_EOL;
|
vertex->flags = PVR_CMD_VERTEX_EOL;
|
||||||
}
|
}
|
||||||
} else if(mode == GL_TRIANGLE_STRIP && j == (max - 1)) {
|
} break;
|
||||||
/* If the mode was triangle strip, then the last vertex is the last vertex */
|
case GL_TRIANGLE_STRIP:
|
||||||
vertex->flags = PVR_CMD_VERTEX_EOL;
|
default: {
|
||||||
|
if(j == (max - 1)) {
|
||||||
|
/* If the mode was triangle strip, then the last vertex is the last vertex */
|
||||||
|
vertex->flags = PVR_CMD_VERTEX_EOL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user