[Piglit] [PATCH] s3tc-errors: add additional texture size checks

Brian Paul brianp at vmware.com
Tue Oct 2 08:59:12 PDT 2012


Zero-sized tex images and sub images should not generate an error.
Full images which are not multiples of the block size should also be legal.

Verified w/ NVIDIA's driver.
---
 tests/texturing/s3tc-errors.c |   38 ++++++++++++++++++++++++++++++++++++++
 1 files changed, 38 insertions(+), 0 deletions(-)

diff --git a/tests/texturing/s3tc-errors.c b/tests/texturing/s3tc-errors.c
index 8a6546d..b4b6776 100644
--- a/tests/texturing/s3tc-errors.c
+++ b/tests/texturing/s3tc-errors.c
@@ -273,6 +273,23 @@ test_format(int width, int height, GLfloat *image, GLenum format)
 
 	pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass;
 
+	/* Try zero-sized subimage - should not be an error */
+	x = 4;
+	y = 4;
+	w = 0;
+	h = 0;
+	glPixelStorei(GL_UNPACK_SKIP_PIXELS, x);
+	glPixelStorei(GL_UNPACK_SKIP_ROWS, y);
+	glCompressedTexSubImage2D(GL_TEXTURE_2D, 0,
+				  x, y, w, h,
+				  format,
+				  piglit_compressed_image_size(format, w, h),
+				  compressed_image +
+				  piglit_compressed_pixel_offset(format, width, x, y));
+
+	pass = piglit_check_gl_error(GL_NO_ERROR) && pass;
+
+
 	/* Try CompressedTexSubImage into level 1 (which is missing) */
 	x = 0;
 	y = 0;
@@ -289,6 +306,27 @@ test_format(int width, int height, GLfloat *image, GLenum format)
 
 	pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass;
 
+	/* Try CompressedTexImage of size zero - should not be an erorr */
+	w = 0;
+	h = 0;
+	glCompressedTexImage2D(GL_TEXTURE_2D, 0, format, w, h, 0,
+			       piglit_compressed_image_size(format, w, h),
+			       compressed_image);
+
+	pass = piglit_check_gl_error(GL_NO_ERROR) && pass;
+
+	/* Try CompressedTexImage with size which is a not a multiple of the
+         * block size - should not be an erorr
+         */
+	w = width - 1;
+	h = height - 1;
+	glCompressedTexImage2D(GL_TEXTURE_2D, 0, format, w, h, 0,
+			       piglit_compressed_image_size(format, w, h),
+			       compressed_image);
+
+	pass = piglit_check_gl_error(GL_NO_ERROR) && pass;
+	pass = check_rendering(width, height) && pass;
+
 	glDeleteTextures(1, &tex);
 
 	free(compressed_image);
-- 
1.7.3.4



More information about the Piglit mailing list