[Piglit] [PATCH 6/7] ext_unpack_subimage/basic: Use piglit_check_gl_error
Ian Romanick
idr at freedesktop.org
Wed Aug 21 08:37:04 PDT 2013
From: Ian Romanick <ian.d.romanick at intel.com>
The test had basically implemented its own version of the function.
Just use the common one.
Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
Cc: Neil Roberts <neil at linux.intel.com>
---
.../spec/ext_unpack_subimage/ext_unpack_subimage.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/tests/spec/ext_unpack_subimage/ext_unpack_subimage.c b/tests/spec/ext_unpack_subimage/ext_unpack_subimage.c
index 12afd9e..8165fe7 100644
--- a/tests/spec/ext_unpack_subimage/ext_unpack_subimage.c
+++ b/tests/spec/ext_unpack_subimage/ext_unpack_subimage.c
@@ -91,18 +91,6 @@ fragment_shader[] =
"gl_FragColor = texture2D(tex, tex_coord);\n"
"}\n";
-static void
-check_error(void)
-{
- if (extension_supported) {
- if (!piglit_check_gl_error(GL_NO_ERROR))
- pass = GL_FALSE;
- } else {
- if (!piglit_check_gl_error(GL_INVALID_ENUM))
- pass = GL_FALSE;
- }
-}
-
enum piglit_result
piglit_display(void)
{
@@ -112,12 +100,15 @@ piglit_display(void)
static const float blue[] = { 0, 0, 1, 1 };
static const float cyan[] = { 0, 1, 1, 1 };
GLuint program;
+ GLenum expected_error;
pass = GL_TRUE;
extension_supported =
piglit_is_extension_supported("GL_EXT_unpack_subimage");
+ expected_error = extension_supported ? GL_NO_ERROR : GL_INVALID_ENUM;
+
if (!piglit_automatic) {
if (extension_supported)
printf("GL_EXT_unpack_subimage is supported\n");
@@ -129,19 +120,19 @@ piglit_display(void)
if (!piglit_automatic)
printf("Trying GL_UNPACK_ROW_LENGTH\n");
glPixelStorei(GL_UNPACK_ROW_LENGTH, 2);
- check_error();
+ pass = piglit_check_gl_error(expected_error) && pass;
piglit_reset_gl_error();
if (!piglit_automatic)
printf("Trying GL_UNPACK_SKIP_PIXELS\n");
glPixelStorei(GL_UNPACK_SKIP_PIXELS, 1);
- check_error();
+ pass = piglit_check_gl_error(expected_error) && pass;
piglit_reset_gl_error();
if (!piglit_automatic)
printf("Trying GL_UNPACK_SKIP_ROWS\n");
glPixelStorei(GL_UNPACK_SKIP_ROWS, 4);
- check_error();
+ pass = piglit_check_gl_error(expected_error) && pass;
glClear(GL_COLOR_BUFFER_BIT);
--
1.8.1.4
More information about the Piglit
mailing list