[Piglit] [PATCH 5/5] textureGather: Use piglit_probe_rect_rgba_varying

Jason Ekstrand jason at jlekstrand.net
Fri Jun 8 01:08:02 UTC 2018


Instead of doing 900 piglit_proble_pixel_rgba calls (one for each pixel)
which each call glReadPixels, use the new helper which only invokes
glReadPixels once.
---
 tests/texturing/shaders/textureGather.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/tests/texturing/shaders/textureGather.c b/tests/texturing/shaders/textureGather.c
index bd369d129..fd3d101c8 100644
--- a/tests/texturing/shaders/textureGather.c
+++ b/tests/texturing/shaders/textureGather.c
@@ -52,7 +52,6 @@ float *expected;
 enum piglit_result
 piglit_display(void)
 {
-	int i, j;
 	bool pass = true;
 
 	glViewport(0, 0, texture_width, texture_height);
@@ -73,11 +72,11 @@ piglit_display(void)
 	else
 		glDrawArrays(GL_POINTS, 0, texture_width * texture_height);
 
-	for (j = 1; j < texture_height - 1; j++)
-		for (i = 1; i < texture_width - 1; i++) {
-			float *pe = &expected[4 * (j * texture_width + i)];
-			pass = piglit_probe_pixel_rgba(i, j, pe) && pass;
-		}
+	pass = piglit_probe_rect_rgba_varying(1, 1,
+					      texture_width - 2,
+					      texture_height - 2,
+					      expected + (texture_width + 1) * 4,
+					      texture_width * 4 * sizeof(float));
 
 	piglit_present_results();
 
-- 
2.17.1



More information about the Piglit mailing list