[Piglit] [PATCH] arb_copy_image: fix a few error check tests

Brian Paul brianp at vmware.com
Mon Aug 31 16:22:10 PDT 2015


Some of the error checks were incorrect before.  Per the spec:

1. GL_TEXTURE_BUFFER and GL_TEXTURE_CUBE_MAP_+/-_XYZ are not legal targets
and should be flagged as invalid enums.

2. GL_INVALID_OPERATION should be generated when trying to copy between
compressed/uncompressed formats whose block/texel size do not match.
---
 tests/spec/arb_copy_image/api_errors.c | 23 +++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)

diff --git a/tests/spec/arb_copy_image/api_errors.c b/tests/spec/arb_copy_image/api_errors.c
index 0ef1eda..6f94d06 100644
--- a/tests/spec/arb_copy_image/api_errors.c
+++ b/tests/spec/arb_copy_image/api_errors.c
@@ -140,7 +140,14 @@ test_simple_errors(GLenum src_target, GLenum dst_target)
 			glCopyImageSubData(src, targets[i], 0, 0, 0, 0,
 					   dst, dst_target, 0, 0, 0, 0,
 					   0, 0, 0);
-			pass &= piglit_check_gl_error(GL_INVALID_ENUM);
+                        if (targets[i] == GL_TEXTURE_BUFFER ||
+			    (targets[i] >= GL_TEXTURE_CUBE_MAP_POSITIVE_X &&
+			     targets[i] <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z)) {
+				pass &= piglit_check_gl_error(GL_INVALID_ENUM);
+			}
+			else {
+				pass &= piglit_check_gl_error(GL_INVALID_VALUE);
+			}
 			if (!pass)
 				return false;
 		}
@@ -154,7 +161,14 @@ test_simple_errors(GLenum src_target, GLenum dst_target)
 			glCopyImageSubData(src, src_target, 0, 0, 0, 0,
 					   dst, targets[i], 0, 0, 0, 0,
 					   0, 0, 0);
-			pass &= piglit_check_gl_error(GL_INVALID_ENUM);
+                        if (targets[i] == GL_TEXTURE_BUFFER ||
+			    (targets[i] >= GL_TEXTURE_CUBE_MAP_POSITIVE_X &&
+			     targets[i] <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z)) {
+				pass &= piglit_check_gl_error(GL_INVALID_ENUM);
+			}
+			else {
+				pass &= piglit_check_gl_error(GL_INVALID_VALUE);
+			}
 			if (!pass)
 				return false;
 		}
@@ -235,14 +249,15 @@ test_compressed_alignment_errors()
 	glTexStorage2D(GL_TEXTURE_2D, 1, GL_RGB16UI, 32, 32);
 	glCopyImageSubData(tex[0], GL_TEXTURE_2D, 0, 0, 0, 0,
 			   tex[2], GL_TEXTURE_2D, 0, 0, 0, 0, 20, 20, 1);
-	pass &= piglit_check_gl_error(GL_INVALID_VALUE);
+	pass &= piglit_check_gl_error(GL_INVALID_OPERATION);
 
+        /* Check for invalid copy between different compressed formats */
 	glBindTexture(GL_TEXTURE_2D, tex[3]);
 	glTexStorage2D(GL_TEXTURE_2D, 1,
 		       GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, 32, 32);
 	glCopyImageSubData(tex[0], GL_TEXTURE_2D, 0, 0, 0, 0,
 			   tex[3], GL_TEXTURE_2D, 0, 0, 0, 0, 20, 20, 1);
-	pass &= piglit_check_gl_error(GL_INVALID_VALUE);
+	pass &= piglit_check_gl_error(GL_INVALID_OPERATION);
 
 	glDeleteTextures(4, tex);
 
-- 
1.9.1



More information about the Piglit mailing list