[Piglit] [PATCH 04/18] triangle-rasterization: Use util function to probe framebuffer.

Fabian Bieler fabianbieler at fastmail.fm
Sun Jan 7 22:13:59 UTC 2018


Use newly created piglit_probe_rect_two_rgb instead of test-local
framebuffer probing code.
---
 tests/general/triangle-rasterization.cpp | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/tests/general/triangle-rasterization.cpp b/tests/general/triangle-rasterization.cpp
index db8fbc4a9..3ebff79cc 100644
--- a/tests/general/triangle-rasterization.cpp
+++ b/tests/general/triangle-rasterization.cpp
@@ -340,22 +340,19 @@ void triangle_art(uint32_t* buffer)
  */
 uint32_t* check_triangle()
 {
+	const float black[] = { 0, 0, 0 };
+	const float yellow[] = { 1, 1, 0 };
+
+	if (piglit_probe_rect_two_rgb(0, 0, fbo_width, fbo_height, black,
+				      yellow))
+		return NULL;
+
 	static uint32_t* buffer = 0;
 	if (!buffer) buffer = new uint32_t[fbo_width * fbo_height];
 
 	glReadPixels(0, 0, fbo_width, fbo_height, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, buffer);
 
-	for (int y = 0; y < fbo_height; ++y) {
-		for (int x = 0; x < fbo_width; ++x) {
-			uint32_t val = buffer[y*fbo_width + x] & 0xFFFFFF00;
-
-			if (val != 0 && val != 0xFFFF0000) {
-				return buffer;
-			}
-		}
-	}
-
-	return NULL;
+	return buffer;
 }
 
 
-- 
2.15.1



More information about the Piglit mailing list