[Piglit] [PATCH 2/2] glean: remove pointless switch statements from fbo test

Brian Paul brianp at vmware.com
Tue Aug 15 23:08:10 UTC 2017


All switch cases did the same thing.  Spotted by Eric Anholt.
---
 tests/glean/tfbo.cpp | 62 +++++++++++++++-------------------------------------
 1 file changed, 18 insertions(+), 44 deletions(-)

diff --git a/tests/glean/tfbo.cpp b/tests/glean/tfbo.cpp
index 1768956..288fb0e 100644
--- a/tests/glean/tfbo.cpp
+++ b/tests/glean/tfbo.cpp
@@ -603,21 +603,12 @@ FBOTest::testRender2SingleTexture(void)
                                         // Init depth buffer
                                         glEnable(GL_DEPTH_TEST);
                                         glDepthFunc(GL_ALWAYS);
-                                        switch (textureModes[mode]) {
-                                        case GL_TEXTURE_1D:
-                                        case GL_TEXTURE_2D:
-                                        case GL_TEXTURE_3D:
-                                        case GL_TEXTURE_CUBE_MAP:
-                                                glBegin(GL_POLYGON);
-                                                glVertex3f(TEXSIZE / 4, 0, 0.3);
-                                                glVertex3f(TEXSIZE * 5 / 8, 0, 0.3);
-                                                glVertex3f(TEXSIZE * 5 / 8, TEXSIZE, 0.3);
-                                                glVertex3f(TEXSIZE / 4, TEXSIZE, 0.3);
-                                                glEnd();
-                                                break;
-                                        default:
-                                                break;
-                                        }
+					glBegin(GL_POLYGON);
+					glVertex3f(TEXSIZE / 4, 0, 0.3);
+					glVertex3f(TEXSIZE * 5 / 8, 0, 0.3);
+					glVertex3f(TEXSIZE * 5 / 8, TEXSIZE, 0.3);
+					glVertex3f(TEXSIZE / 4, TEXSIZE, 0.3);
+					glEnd();
                                         glDepthFunc(GL_LESS);
                                 }
 
@@ -628,22 +619,12 @@ FBOTest::testRender2SingleTexture(void)
                                         glStencilFunc(GL_ALWAYS, 0x1, 0x1);
                                         glStencilOp(GL_KEEP,
                                                     GL_KEEP, GL_REPLACE);
-                                        switch (textureModes[mode]) {
-                                        case GL_TEXTURE_1D:
-                                        case GL_TEXTURE_2D:
-                                        case GL_TEXTURE_3D:
-                                        case GL_TEXTURE_CUBE_MAP:
-                                                glBegin(GL_POLYGON);
-                                                glVertex3f(TEXSIZE / 2, 0, 0.3);
-                                                glVertex3f(TEXSIZE * 7 / 8, 0, 0.3);
-                                                glVertex3f(TEXSIZE * 7 / 8, TEXSIZE, 0.3);
-                                                glVertex3f(TEXSIZE / 2, TEXSIZE, 0.3);
-                                                glEnd();
-                                                break;
-                                        default:
-                                                break;
-                                        }
-
+ 					glBegin(GL_POLYGON);
+					glVertex3f(TEXSIZE / 2, 0, 0.3);
+					glVertex3f(TEXSIZE * 7 / 8, 0, 0.3);
+					glVertex3f(TEXSIZE * 7 / 8, TEXSIZE, 0.3);
+					glVertex3f(TEXSIZE / 2, TEXSIZE, 0.3);
+					glEnd();
                                         glStencilFunc(GL_NOTEQUAL, 0x1, 0x1);
                                 }
 
@@ -654,19 +635,12 @@ FBOTest::testRender2SingleTexture(void)
                                 glClearColor(0.0, 0.0, 0.0, 0.0);
                                 glClear(GL_COLOR_BUFFER_BIT);
 
-                                switch (textureModes[mode]) {
-                                case GL_TEXTURE_1D:
-                                case GL_TEXTURE_2D:
-                                case GL_TEXTURE_3D:
-                                case GL_TEXTURE_CUBE_MAP:
-                                        glBegin(GL_POLYGON);
-                                        glVertex3f(0, 0, 0.2);
-                                        glVertex3f(TEXSIZE, 0, 0.2);
-                                        glVertex3f(TEXSIZE, TEXSIZE, 0.2);
-                                        glVertex3f(0, TEXSIZE, 0.2);
-                                        glEnd();
-                                        break;
-                                }
+				glBegin(GL_POLYGON);
+				glVertex3f(0, 0, 0.2);
+ 				glVertex3f(TEXSIZE, 0, 0.2);
+				glVertex3f(TEXSIZE, TEXSIZE, 0.2);
+				glVertex3f(0, TEXSIZE, 0.2);
+				glEnd();
 
                                 // Render to the window
                                 glEnable(textureModes[mode]);
-- 
1.9.1



More information about the Piglit mailing list