[Piglit] [PATCH 3/4] Make piglit_probe_image_rgb[a] continue probing even after a bad pixel.

Kenneth Graunke kenneth at whitecape.org
Tue Nov 29 23:32:29 PST 2011


piglit_probe_image_rgba is supposed to probe a whole rectangle's worth
of pixels, comparing them against the supplied image.  Previously, it
would stop probing after it found one incorrect pixel, failing to report
any other bad pixels.  This was misleading since silence usually means
"probe was correct".

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
---
 tests/util/piglit-util-gl.c |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

There's only one test that uses this, and I doubt it minds.  I use it in
the next patch.

diff --git a/tests/util/piglit-util-gl.c b/tests/util/piglit-util-gl.c
index b743a08..8194606 100644
--- a/tests/util/piglit-util-gl.c
+++ b/tests/util/piglit-util-gl.c
@@ -145,6 +145,7 @@ int
 piglit_probe_image_rgb(int x, int y, int w, int h, const float *image)
 {
 	int i, j, p;
+	bool pass = true;
 	GLfloat *probe;
 	GLfloat *pixels = malloc(w*h*3*sizeof(float));
 
@@ -162,22 +163,22 @@ piglit_probe_image_rgb(int x, int y, int w, int h, const float *image)
 					       expected[0], expected[1], expected[2]);
 					printf("  Observed: %f %f %f\n",
 					       probe[0], probe[1], probe[2]);
-
-					free(pixels);
-					return 0;
+					pass = false;
+					break;
 				}
 			}
 		}
 	}
 
 	free(pixels);
-	return 1;
+	return pass;
 }
 
 int
 piglit_probe_image_rgba(int x, int y, int w, int h, const float *image)
 {
 	int i, j, p;
+	bool pass = true;
 	GLfloat *probe;
 	GLfloat *pixels = malloc(w*h*4*sizeof(float));
 
@@ -195,16 +196,15 @@ piglit_probe_image_rgba(int x, int y, int w, int h, const float *image)
 					       expected[0], expected[1], expected[2], expected[3]);
 					printf("  Observed: %f %f %f %f\n",
 					       probe[0], probe[1], probe[2], probe[3]);
-
-					free(pixels);
-					return 0;
+					pass = false;
+					break;
 				}
 			}
 		}
 	}
 
 	free(pixels);
-	return 1;
+	return pass;
 }
 
 /**
-- 
1.7.7.3



More information about the Piglit mailing list