Switches instead of if ladders
This commit is contained in:
parent
8ca70a2920
commit
b6593acc83
35
GL/draw.c
35
GL/draw.c
|
@ -866,14 +866,15 @@ static void generate(SubmissionTarget* target, const GLenum mode, const GLsizei
|
||||||
if(indices) {
|
if(indices) {
|
||||||
generateElementsFastPath(target, first, count, indices, type);
|
generateElementsFastPath(target, first, count, indices, type);
|
||||||
} else {
|
} else {
|
||||||
if(mode == GL_QUADS) {
|
switch(mode) {
|
||||||
generateArraysFastPath_QUADS(target, first, count);
|
case GL_QUADS:
|
||||||
return; // Don't need to do any more processing
|
generateArraysFastPath_QUADS(target, first, count);
|
||||||
} else if(mode == GL_TRIANGLES) {
|
return; // Don't need to do any more processing
|
||||||
generateArraysFastPath_TRIS(target, first, count);
|
case GL_TRIANGLES:
|
||||||
return; // Don't need to do any more processing
|
generateArraysFastPath_TRIS(target, first, count);
|
||||||
} else {
|
return; // Don't need to do any more processing
|
||||||
generateArraysFastPath_ALL(target, first, count);
|
default:
|
||||||
|
generateArraysFastPath_ALL(target, first, count);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -1088,12 +1089,18 @@ GL_FORCE_INLINE void submitVertices(GLenum mode, GLsizei first, GLuint count, GL
|
||||||
* We optimise the triangle and quad cases.
|
* We optimise the triangle and quad cases.
|
||||||
*/
|
*/
|
||||||
if(mode == GL_POLYGON) {
|
if(mode == GL_POLYGON) {
|
||||||
if(count == 3) {
|
switch(count) {
|
||||||
mode = GL_TRIANGLES;
|
case 2:
|
||||||
} else if(count == 4) {
|
mode = GL_LINES;
|
||||||
mode = GL_QUADS;
|
break;
|
||||||
} else {
|
case 3:
|
||||||
mode = GL_TRIANGLE_FAN;
|
mode = GL_TRIANGLES;
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
mode = GL_QUADS;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
mode = GL_TRIANGLE_FAN;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user