[Piglit] [PATCH 12/14] oes_compressed_paletted_texture: relax glTexImage2D error value expectation

Marek Olšák maraeo at gmail.com
Mon Apr 13 11:28:12 PDT 2015


From: Daniel Kurtz <djkurtz at chromium.org>

The OES_compressed_paletted_texture spec [0] is very clear that
GL_INVALID_OPERATION should be returned by TexImage2D and friends if
internalformat is one of formats defined in the spec.

[0] https://www.opengl.org/registry/specs/OES/OES_compressed_paletted_texture.txt

It is totally reasonable that some implementations may return that error.
So, allow the test to pass in that case.

Signed-off-by: Daniel Kurtz <djkurtz at chromium.org>
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
---
 .../oes_compressed_paletted_texture-api.c                  | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/tests/spec/oes_compressed_paletted_texture/oes_compressed_paletted_texture-api.c b/tests/spec/oes_compressed_paletted_texture/oes_compressed_paletted_texture-api.c
index d97b9dc..13b0bba 100644
--- a/tests/spec/oes_compressed_paletted_texture/oes_compressed_paletted_texture-api.c
+++ b/tests/spec/oes_compressed_paletted_texture/oes_compressed_paletted_texture-api.c
@@ -100,8 +100,18 @@ piglit_init(int argc, char **argv)
 			     16, 16, 0,
 			     t[i].internal_format, t[i].type, buffer);
 #if defined(PIGLIT_USE_OPENGL_ES1) || defined(PIGLIT_USE_OPENGL_ES2)
-		if (!piglit_check_gl_error(GL_INVALID_VALUE))
-			piglit_report_result(PIGLIT_FAIL);
+		{
+			GLenum error = glGetError();
+			if (error != GL_INVALID_VALUE && error != GL_INVALID_OPERATION) {
+				printf("Unexpected GL error: %s 0x%x\n",
+				       piglit_get_gl_error_name(error), error);
+				printf("(Error at %s:%u)\n", __func__, __LINE__);
+				printf("Expected GL error: %s 0x%x or %s 0x%x\n",
+				       piglit_get_gl_error_name(GL_INVALID_VALUE), GL_INVALID_VALUE,
+				       piglit_get_gl_error_name(GL_INVALID_OPERATION), GL_INVALID_OPERATION);
+				piglit_report_result(PIGLIT_FAIL);
+			}
+		}
 #else
 		if (!piglit_check_gl_error(GL_INVALID_OPERATION))
 			piglit_report_result(PIGLIT_FAIL);
-- 
2.1.0



More information about the Piglit mailing list