[Piglit] [PATCH 03/11] max-texture-size: Delete copy and pasted error checking from proxy test.

Kenneth Graunke kenneth at whitecape.org
Sun Feb 2 03:13:51 PST 2014


The exact same code appeared in every single case of the switch
statement.  Moving it after the switch statement has the same effect
without all the duplication.

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
---
 tests/texturing/max-texture-size.c | 43 +++++++-------------------------------
 1 file changed, 8 insertions(+), 35 deletions(-)

diff --git a/tests/texturing/max-texture-size.c b/tests/texturing/max-texture-size.c
index 15029d9..24d2122 100644
--- a/tests/texturing/max-texture-size.c
+++ b/tests/texturing/max-texture-size.c
@@ -188,66 +188,39 @@ test_proxy_texture_size(GLenum target, GLenum internalformat)
 	case GL_TEXTURE_1D:
 		glTexImage1D(GL_PROXY_TEXTURE_1D, 0, internalformat,
 			     maxSide, 0, GL_RGBA, GL_FLOAT, NULL);
-
-		err = glGetError();
-		/* Report a GL error other than GL_OUT_OF_MEMORY */
-		if (err != GL_NO_ERROR && err != GL_OUT_OF_MEMORY) {
-			printf("Unexpected GL error: 0x%x\n", err);
-			return false;
-		}
 		break;
 
 	case GL_TEXTURE_2D:
 		glTexImage2D(GL_PROXY_TEXTURE_2D, 0, internalformat,
 			     maxSide, maxSide, 0, GL_RGBA, GL_FLOAT,
 			     NULL);
-
-		err = glGetError();
-		/* Report a GL error other than GL_OUT_OF_MEMORY */
-		if (err != GL_NO_ERROR && err != GL_OUT_OF_MEMORY) {
-			printf("Unexpected GL error: 0x%x\n", err);
-			return false;
-		}
 		break;
 
 	case GL_TEXTURE_RECTANGLE:
 		glTexImage2D(target, 0, internalformat, maxSide,
 			     maxSide, 0, GL_RGBA, GL_FLOAT, NULL);
-
-		err = glGetError();
-		/* Report a GL error other than GL_OUT_OF_MEMORY */
-		if (err != GL_NO_ERROR && err != GL_OUT_OF_MEMORY) {
-			printf("Unexpected GL error: 0x%x\n", err);
-			return false;
-		}
 		break;
 
 	case GL_TEXTURE_3D:
 		glTexImage3D(GL_PROXY_TEXTURE_3D, 0, internalformat,
 			     maxSide, maxSide, maxSide, 0, GL_RGBA,
 			     GL_FLOAT, NULL);
-
-		err = glGetError();
-		/* Report a GL error other than GL_OUT_OF_MEMORY */
-		if (err != GL_NO_ERROR && err != GL_OUT_OF_MEMORY) {
-			printf("Unexpected GL error: 0x%x\n", err);
-			return false;
-		}
 		break;
 
 	case GL_TEXTURE_CUBE_MAP:
 		glTexImage2D(GL_PROXY_TEXTURE_CUBE_MAP, 0,
 			     internalformat, maxSide, maxSide, 0,
 			     GL_RGBA, GL_FLOAT, NULL);
-
-		err = glGetError();
-		/* Report a GL error other than GL_OUT_OF_MEMORY */
-		if (err != GL_NO_ERROR && err != GL_OUT_OF_MEMORY) {
-			printf("Unexpected GL error: 0x%x\n", err);
-			return false;
-		}
 		break;
 	}
+
+	err = glGetError();
+	/* Report a GL error other than GL_OUT_OF_MEMORY */
+	if (err != GL_NO_ERROR && err != GL_OUT_OF_MEMORY) {
+		printf("Unexpected GL error: 0x%x\n", err);
+		return false;
+	}
+
 	return true;
 }
 
-- 
1.8.5.2



More information about the Piglit mailing list