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