From 0159bc7c6110f2eca940707fb85c27d6975ebdef Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 18 Mar 2013 18:13:02 -0600 Subject: fbo-clear-formats: clean up error handling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use piglit_check_gl_error(). Note: we're getting an INVALID_OPERATION error from glBlitFramebuffer() with NVIDIA's driver. That'll be investigated/fixed separately. At least the test now reports FAIL instead of dying on an assertion. Reviewed-by: José Fonseca --- tests/fbo/fbo-clear-formats.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/tests/fbo/fbo-clear-formats.c b/tests/fbo/fbo-clear-formats.c index f6b2a727..7a558cc2 100644 --- a/tests/fbo/fbo-clear-formats.c +++ b/tests/fbo/fbo-clear-formats.c @@ -218,7 +218,11 @@ do_stencil_clear(GLenum format, GLuint tex, int level, int size) glDrawBuffer(draw_buffer); glReadBuffer(read_buffer); - assert(glGetError() == 0); + + if (!piglit_check_gl_error(GL_NO_ERROR)) { + /* Should be no error at this point. If there is, report failure */ + piglit_report_result(PIGLIT_FAIL); + } return true; } @@ -285,7 +289,11 @@ create_tex(GLenum internalformat, GLenum baseformat) glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, level - 1); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0); - assert(glGetError() == 0); + if (!piglit_check_gl_error(GL_NO_ERROR)) { + /* Should be no error at this point. If there is, report failure */ + piglit_report_result(PIGLIT_FAIL); + } + return tex; } @@ -323,13 +331,16 @@ draw_stencil_mipmap(int x, int y, int dim, GLuint tex, GLuint level) glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); glBlitFramebuffer(0, 0, dim, dim, x, y, x+dim, y+dim, GL_STENCIL_BUFFER_BIT, GL_NEAREST); + if (!piglit_check_gl_error(GL_NO_ERROR)) { + /* The blit shouldn't generate an error. If it does, report failure */ + piglit_report_result(PIGLIT_FAIL); + } + glBindFramebuffer(GL_FRAMEBUFFER, 0); glDeleteFramebuffers(1, &fbo); glDrawBuffer(draw_buffer); glReadBuffer(read_buffer); - - assert(glGetError() == 0); } static void -- cgit v1.2.3