[Piglit] [PATCH 1/2] texture-storage: fix internal format mistakes in the test

Brian Paul brianp at vmware.com
Sat Sep 8 08:50:16 PDT 2012


Per issue 17 of the extension spec, unsized internalFormat values are
not allowed.  Change GL_RGBA to GL_RGBA8 and add some extra error
checks.

The test passes on NVIDIA now.
---
 tests/spec/arb_texture_storage/texture-storage.c |   22 ++++++++++++++--------
 1 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/tests/spec/arb_texture_storage/texture-storage.c b/tests/spec/arb_texture_storage/texture-storage.c
index c10546e..3a94030 100644
--- a/tests/spec/arb_texture_storage/texture-storage.c
+++ b/tests/spec/arb_texture_storage/texture-storage.c
@@ -69,15 +69,17 @@ test_one_level_errors(GLenum target)
 	glBindTexture(target, tex);
 
 	if (target == GL_TEXTURE_1D) {
-		glTexStorage1D(target, 1, GL_RGBA, width);
+		glTexStorage1D(target, 1, GL_RGBA8, width);
 	}
 	else if (target == GL_TEXTURE_2D) {
-		glTexStorage2D(target, 1, GL_RGBA, width, height);
+		glTexStorage2D(target, 1, GL_RGBA8, width, height);
 	}
 	else if (target == GL_TEXTURE_3D) {
-		glTexStorage3D(target, 1, GL_RGBA, width, height, depth);
+		glTexStorage3D(target, 1, GL_RGBA8, width, height, depth);
 	}
 
+	piglit_check_gl_error(GL_NO_ERROR);
+
 	glGetTexLevelParameteriv(target, 0, GL_TEXTURE_WIDTH, &v);
 	if (v != width) {
 		printf("%s: bad width: %d, should be %d\n", TestName, v, width);
@@ -111,7 +113,7 @@ test_one_level_errors(GLenum target)
 			return GL_FALSE;
 		}
 
-		glTexStorage2D(target, 1, GL_RGBA, width, height);
+		glTexStorage2D(target, 1, GL_RGBA8, width, height);
 		if (glGetError() != GL_INVALID_OPERATION) {
 			printf("%s: glTexStorage2D() failed to generate error\n", TestName);
 			return GL_FALSE;
@@ -149,18 +151,20 @@ test_mipmap_errors(GLenum target)
 	glBindTexture(target, tex);
 
 	if (target == GL_TEXTURE_1D) {
-		glTexStorage1D(target, levels, GL_RGBA, width);
+		glTexStorage1D(target, levels, GL_RGBA8, width);
 		targetString = "GL_TEXTURE_1D";
 	}
 	else if (target == GL_TEXTURE_2D) {
-		glTexStorage2D(target, levels, GL_RGBA, width, height);
+		glTexStorage2D(target, levels, GL_RGBA8, width, height);
 		targetString = "GL_TEXTURE_2D";
 	}
 	else if (target == GL_TEXTURE_3D) {
-		glTexStorage3D(target, levels, GL_RGBA, width, height, depth);
+		glTexStorage3D(target, levels, GL_RGBA8, width, height, depth);
 		targetString = "GL_TEXTURE_3D";
 	}
 
+	piglit_check_gl_error(GL_NO_ERROR);
+
 	glGetTexParameteriv(target, GL_TEXTURE_IMMUTABLE_FORMAT, &v);
 	if (!v) {
 		printf("%s: %s GL_TEXTURE_IMMUTABLE_FORMAT query returned false\n",		       TestName, targetString);
@@ -238,7 +242,9 @@ test_2d_mipmap_rendering(void)
 	glGenTextures(1, &tex);
 	glBindTexture(GL_TEXTURE_2D, tex);
 
-	glTexStorage2D(GL_TEXTURE_2D, levels, GL_RGBA, width, height);
+	glTexStorage2D(GL_TEXTURE_2D, levels, GL_RGBA8, width, height);
+
+	piglit_check_gl_error(GL_NO_ERROR);
 
 	/* check that the mipmap level sizes are correct */
 	for (l = 0; l < levels; l++) {
-- 
1.7.3.4



More information about the Piglit mailing list