[Piglit] [PATCH 4/5] texture-packed-formats: Move some GL state transitions outside of the loop.

Eric Anholt eric at anholt.net
Fri Oct 24 10:07:50 PDT 2014


---
 tests/texturing/texture-packed-formats.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/tests/texturing/texture-packed-formats.c b/tests/texturing/texture-packed-formats.c
index 953bc95..e53f71e 100644
--- a/tests/texturing/texture-packed-formats.c
+++ b/tests/texturing/texture-packed-formats.c
@@ -246,6 +246,11 @@ Test(GLuint intFmt, GLuint dims)
 
 	glClear(GL_COLOR_BUFFER_BIT);
 
+	if (dims == 3)
+		glEnable(GL_TEXTURE_3D);
+	else
+		glEnable(GL_TEXTURE_2D);
+
 	/* Loop over byteswapping */
 	for (swap = 0; swap < 2; swap++) {
 		/* Loop over texture formats */
@@ -262,11 +267,6 @@ Test(GLuint intFmt, GLuint dims)
 				return GL_FALSE;
 			}
 
-			if (dims == 3)
-				glEnable(GL_TEXTURE_3D);
-			else
-				glEnable(GL_TEXTURE_2D);
-
 			glBegin(GL_POLYGON);
 			glTexCoord3f(0, 0, 0.5);  glVertex2f(x + 0, y + 0);
 			glTexCoord3f(1, 0, 0.5);  glVertex2f(x + w, y + 0);
@@ -274,11 +274,6 @@ Test(GLuint intFmt, GLuint dims)
 			glTexCoord3f(0, 1, 0.5);  glVertex2f(x + 0, y + h);
 			glEnd();
 
-			if (dims == 3)
-				glDisable(GL_TEXTURE_3D);
-			else
-				glDisable(GL_TEXTURE_2D);
-
 			/* test rendering */
 			if (!piglit_probe_rect_rgb(x, y, w, 2, red)) {
 				printf("Failure for format=%s, swap=%u, "
@@ -296,6 +291,11 @@ Test(GLuint intFmt, GLuint dims)
 		}
 	}
 
+	if (dims == 3)
+		glDisable(GL_TEXTURE_3D);
+	else
+		glDisable(GL_TEXTURE_2D);
+
 	piglit_present_results();
 
 	return pass;
-- 
2.1.1



More information about the Piglit mailing list