[Piglit] [PATCH 08/15] fbo-storage-*: Use piglit_check_gl_error().

Eric Anholt eric at anholt.net
Mon Jan 14 10:55:35 PST 2013


---
 tests/fbo/fbo-storage-completeness.c |   33 ++++++++++++---------------------
 tests/fbo/fbo-storage-formats.c      |   22 ++++++----------------
 2 files changed, 18 insertions(+), 37 deletions(-)

diff --git a/tests/fbo/fbo-storage-completeness.c b/tests/fbo/fbo-storage-completeness.c
index ef9a4bb..3842684 100644
--- a/tests/fbo/fbo-storage-completeness.c
+++ b/tests/fbo/fbo-storage-completeness.c
@@ -41,21 +41,6 @@ config.window_visual = PIGLIT_GL_VISUAL_RGB;
 
 PIGLIT_GL_TEST_CONFIG_END
 
-static const char *TestName = "fbo-storage-formats";
-
-
-static void
-check_error(int line)
-{
-	GLenum err = glGetError();
-	if (err) {
-		printf("%s: Unexpected error 0x%x at line %d\n",
-		       TestName, err, line);
-		piglit_report_result(PIGLIT_FAIL);
-	}
-}
-
-
 #define EXT_packed_depth_stencil 1
 #define ARB_framebuffer_object 2
 #define ARB_texture_rg 3
@@ -160,17 +145,20 @@ test(void)
 
 		glGenFramebuffersEXT(1, &fbo);
 		glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fbo);
-		check_error(__LINE__);
+		if (!piglit_check_gl_error(GL_NO_ERROR))
+			piglit_report_result(PIGLIT_FAIL);
 
 		glGenRenderbuffersEXT(1, &rb);
-		check_error(__LINE__);
+		if (!piglit_check_gl_error(GL_NO_ERROR))
+			piglit_report_result(PIGLIT_FAIL);
 		glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, rb);
 
 		glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT,
 					     GL_COLOR_ATTACHMENT0,
 					     GL_RENDERBUFFER_EXT,
 					     rb);
-		check_error(__LINE__);
+		if (!piglit_check_gl_error(GL_NO_ERROR))
+			piglit_report_result(PIGLIT_FAIL);
 
 		glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, Formats[i].format,
 					 piglit_width, piglit_height);
@@ -197,17 +185,20 @@ test(void)
 
 	glGenFramebuffersEXT(1, &fbo);
 	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fbo);
-	check_error(__LINE__);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	glGenRenderbuffersEXT(1, &rb);
-	check_error(__LINE__);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 	glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, rb);
 
 	glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT,
 				     GL_COLOR_ATTACHMENT0,
 				     GL_RENDERBUFFER_EXT,
 				     rb);
-	check_error(__LINE__);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, Formats[complete].format,
 				 piglit_width, piglit_height);
diff --git a/tests/fbo/fbo-storage-formats.c b/tests/fbo/fbo-storage-formats.c
index f9b5c41..5487a03 100644
--- a/tests/fbo/fbo-storage-formats.c
+++ b/tests/fbo/fbo-storage-formats.c
@@ -42,19 +42,6 @@ PIGLIT_GL_TEST_CONFIG_END
 
 static const char *TestName = "fbo-storage-formats";
 
-
-static void
-check_error(int line)
-{
-	GLenum err = glGetError();
-	if (err) {
-		printf("%s: Unexpected error 0x%x at line %d\n",
-		       TestName, err, line);
-		piglit_report_result(PIGLIT_FAIL);
-	}
-}
-
-
 #define EXT_packed_depth_stencil 1
 #define ARB_framebuffer_object 2
 #define ARB_texture_rg 3
@@ -182,17 +169,20 @@ test(void)
 
 	glGenFramebuffersEXT(1, &fbo);
 	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fbo);
-	check_error(__LINE__);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	glGenRenderbuffersEXT(1, &rb);
-	check_error(__LINE__);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 	glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, rb);
 
 	glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT,
 				     GL_COLOR_ATTACHMENT0,
 				     GL_RENDERBUFFER_EXT,
 				     rb);
-	check_error(__LINE__);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 
 	/* clear out any errors */
 	while (glGetError())
-- 
1.7.10.4



More information about the Piglit mailing list