[Piglit] [PATCH] s3tc: fix error checking when NPOT is not available

Ilia Mirkin imirkin at alum.mit.edu
Sun Dec 30 23:35:10 UTC 2018


Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
---
 tests/texturing/s3tc-errors.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/tests/texturing/s3tc-errors.c b/tests/texturing/s3tc-errors.c
index 7e9bfa8b5..ccc0be9a7 100644
--- a/tests/texturing/s3tc-errors.c
+++ b/tests/texturing/s3tc-errors.c
@@ -412,7 +412,7 @@ test_format(int width, int height, GLfloat *image, GLenum requested_format)
 	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
+         * block size - should not be an error
          */
 	w = width - 1;
 	h = height - 1;
@@ -420,6 +420,18 @@ test_format(int width, int height, GLfloat *image, GLenum requested_format)
 			       piglit_compressed_image_size(format, w, h),
 			       compressed_image);
 
+	if (piglit_get_gl_version() < 20 &&
+	    !piglit_is_extension_supported("GL_ARB_texture_non_power_of_two")) {
+		pass = piglit_check_gl_error(GL_INVALID_VALUE) && pass;
+
+		/* Reload the original into the texture. */
+		w = width;
+		h = height;
+		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;
 
-- 
2.18.1



More information about the Piglit mailing list