[Piglit] [PATCH 2/9] arb_geometry_shader4/ignoreadjacent-vertices: Use piglit_probe_rect_two_rgba.

Fabian Bieler fabianbieler at fastmail.fm
Tue Jun 18 06:55:36 PDT 2013


Use the newly introduced piglit_probe_rect_two_rgba to check the framebuffer.
---
 .../execution/ignore-adjacent-vertices.c           | 36 +++-------------------
 1 file changed, 4 insertions(+), 32 deletions(-)

diff --git a/tests/spec/arb_geometry_shader4/execution/ignore-adjacent-vertices.c b/tests/spec/arb_geometry_shader4/execution/ignore-adjacent-vertices.c
index 78cdd16..a5b0690 100644
--- a/tests/spec/arb_geometry_shader4/execution/ignore-adjacent-vertices.c
+++ b/tests/spec/arb_geometry_shader4/execution/ignore-adjacent-vertices.c
@@ -101,37 +101,6 @@ PIGLIT_GL_TEST_CONFIG_END
 
 GLuint color_uniform;
 
-/* Check that the framebuffer is yellow and black. */
-static bool
-check_framebuffer(void)
-{
-	int y, x;
-	uint32_t *buffer = malloc(sizeof(uint32_t) * piglit_width *
-				  piglit_height);
-#ifdef __BIG_ENDIAN__
-	const GLenum type = GL_UNSIGNED_INT_8_8_8_8_REV;
-#else
-	const GLenum type = GL_UNSIGNED_INT_8_8_8_8;
-#endif
-
-	glReadPixels(0, 0, piglit_width, piglit_height, GL_RGBA, type, buffer);
-
-	for (y = 0; y < piglit_height; ++y) {
-		for (x = 0; x < piglit_width; ++x) {
-			uint32_t val = buffer[y * piglit_width + x] &
-				0xFFFFFF00;
-
-			if (val != 0 && val != 0xFFFF0000) {
-				fprintf(stderr,
-					"FAIL: Rendered primitives differ.\n");
-				return false;
-			}
-		}
-	}
-
-	free(buffer);
-	return true;
-}
 
 /* Parse command line arguments.
  *
@@ -229,6 +198,8 @@ piglit_display(void)
 	bool pass = true;
 	const float red[] = {1, 0, 0, 1};
 	const float green[] = {0, 1, 0, 1};
+	const float black[] = {0, 0, 0, 0};
+	const float yellow[] = {1, 1, 0, 1};
 
 	glClear(GL_COLOR_BUFFER_BIT);
 
@@ -240,7 +211,8 @@ piglit_display(void)
 	glUniform4fv(color_uniform, 1, green);
 	draw(test->base);
 
-	pass = check_framebuffer() && pass;
+	pass = piglit_probe_rect_two_rgba(0, 0, piglit_width, piglit_height,
+					  black, yellow) && pass;
 	pass = piglit_check_gl_error(GL_NO_ERROR) && pass;
 
 	if (!piglit_automatic)
-- 
1.8.1.2



More information about the Piglit mailing list