On 25 August 2012 01:12, Chris Forbes <span dir="ltr"><<a href="mailto:chrisf@ijw.co.nz" target="_blank">chrisf@ijw.co.nz</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Signed-off-by: Chris Forbes <<a href="mailto:chrisf@ijw.co.nz">chrisf@ijw.co.nz</a>><br>
---<br>
 tests/shaders/fp-incomplete-tex.c | 41 +++++++--------------------------------<br>
 tests/shaders/fp-kil.c            | 41 +++++++--------------------------------<br>
 tests/texturing/crossbar.c        | 30 ++++++----------------------<br>
 3 files changed, 20 insertions(+), 92 deletions(-)<br>
<br>
diff --git a/tests/shaders/fp-incomplete-tex.c b/tests/shaders/fp-incomplete-tex.c<br>
index 480aee2..458c440 100644<br>
--- a/tests/shaders/fp-incomplete-tex.c<br>
+++ b/tests/shaders/fp-incomplete-tex.c<br>
@@ -130,45 +130,18 @@ static const struct {<br>
<br>
 static int DoTest( void )<br>
 {<br>
-       int idx;<br>
-       GLfloat dmax;<br>
+       int idx = 0;<br>
+       int pass = GL_TRUE;<br>
<br>
-       dmax = 0;<br>
-<br>
-       idx = 0;<br>
        while(Probes[idx].name) {<br>
-               GLfloat probe[4];<br>
-               GLfloat delta[4];<br>
-               int i;<br>
-<br>
-               glReadPixels((int)(Probes[idx].x * piglit_width / 3),<br>
-                            (int)(Probes[idx].y * piglit_height / 2),<br>
-                            1, 1,<br>
-               GL_RGBA, GL_FLOAT, probe);<br>
-<br>
-               printf("%20s (%3.1f,%3.1f): %f,%f,%f,%f",<br>
-                      Probes[idx].name,<br>
-                      Probes[idx].x, Probes[idx].y,<br>
-                      probe[0], probe[1], probe[2], probe[3]);<br>
-<br>
-               for(i = 0; i < 4; ++i) {<br>
-                       delta[i] = probe[i] - Probes[idx].expected[i];<br>
-<br>
-                       if (delta[i] > dmax) dmax = delta[i];<br>
-                       else if (-delta[i] > dmax) dmax = -delta[i];<br>
-               }<br>
-<br>
-               printf("   Delta: %f,%f,%f,%f\n", delta[0], delta[1], delta[2], delta[3]);<br>
-<br>
+               pass &= piglit_probe_pixel_rgba(<br>
+                       (int)(Probes[idx].x * piglit_width / 3),<br>
+                       (int)(Probes[idx].y * piglit_height / 2),<br>
+                       Probes[idx].expected);<br></blockquote><div><br>Minor nit-pick:  Our usual convention is to make "pass" a bool, and to write this as "pass = piglit_probe_pixel_rgba(...) && pass", just so that it's clear that there aren't any bitwise shenanigans going on.  Note that it would probably make sense to also change the return type of DoTest(), and the type of "pass" in piglit_display(), to bool as well.  I won't be a stickler about it though.<br>
<br>This comment applies to fp-kil.c and crossbar.c as well.<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
                idx++;<br>
        }<br>
<br>
-       printf("Max delta: %f\n", dmax);<br>
-<br>
-       if (dmax >= 0.02)<br>
-               return 0;<br>
-       else<br>
-               return 1;<br>
+       return pass;<br>
 }<br>
<br>
<br>
diff --git a/tests/shaders/fp-kil.c b/tests/shaders/fp-kil.c<br>
index d9b78fe..6ba1f9d 100644<br>
--- a/tests/shaders/fp-kil.c<br>
+++ b/tests/shaders/fp-kil.c<br>
@@ -205,45 +205,18 @@ static const struct {<br>
<br>
 static int DoTest( void )<br>
 {<br>
-       int idx;<br>
-       GLfloat dmax;<br>
+       int idx = 0;<br>
+       int pass = GL_TRUE;<br>
<br>
-       dmax = 0;<br>
-<br>
-       idx = 0;<br>
        while(Probes[idx].name) {<br>
-               GLfloat probe[4];<br>
-               GLfloat delta[4];<br>
-               int i;<br>
-<br>
-               glReadPixels((int)(Probes[idx].x*piglit_width/2),<br>
-                            (int)(Probes[idx].y*piglit_height/2),<br>
-                            1, 1,<br>
-                            GL_RGBA, GL_FLOAT, probe);<br>
-<br>
-               printf("%20s (%3.1f,%3.1f): %f,%f,%f,%f",<br>
-                      Probes[idx].name,<br>
-                      Probes[idx].x, Probes[idx].y,<br>
-                      probe[0], probe[1], probe[2], probe[3]);<br>
-<br>
-               for(i = 0; i < 4; ++i) {<br>
-                       delta[i] = probe[i] - Probes[idx].expected[i];<br>
-<br>
-                       if (delta[i] > dmax) dmax = delta[i];<br>
-                       else if (-delta[i] > dmax) dmax = -delta[i];<br>
-               }<br>
-<br>
-               printf("   Delta: %f,%f,%f,%f\n", delta[0], delta[1], delta[2], delta[3]);<br>
-<br>
+               pass &= piglit_probe_pixel_rgba(<br>
+                       (int)(Probes[idx].x*piglit_width/2),<br>
+                   (int)(Probes[idx].y*piglit_height/2),<br>
+                       Probes[idx].expected);<br></blockquote><div><br>Inconsistent indentation here.<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
                idx++;<br>
        }<br>
<br>
-       printf("Max delta: %f\n", dmax);<br>
-<br>
-       if (dmax >= 0.02)<br>
-               return 0;<br>
-       else<br>
-               return 1;<br>
+       return pass;<br>
 }<br>
<br>
 enum piglit_result<br>
diff --git a/tests/texturing/crossbar.c b/tests/texturing/crossbar.c<br>
index 497ff31..1cc716d 100644<br>
--- a/tests/texturing/crossbar.c<br>
+++ b/tests/texturing/crossbar.c<br>
@@ -112,35 +112,17 @@ static void DoFrame( void )<br>
<br>
 static int DoTest( void )<br>
 {<br>
+   const static float expected[] = {0.5f, 0.5f, 0.5f};<br>
+   int pass = GL_TRUE;<br>
    int i;<br>
-   GLfloat probe[NUM_TESTS+1][4];<br>
-   GLfloat dr, dg, db;<br>
-   GLfloat dmax;<br>
<br>
-   glReadBuffer( GL_BACK );<br>
-<br>
-   dmax = 0;<br>
    for( i = 0; i <= NUM_TESTS; ++i ) {<br>
-      glReadPixels(piglit_width*(2*i+1)/((NUM_TESTS+1)*2), piglit_height/2, 1, 1, GL_RGBA, GL_FLOAT, probe[i]);<br>
-      printf("Probe %i: %f,%f,%f\n", i, probe[i][0], probe[i][1], probe[i][2]);<br>
-      dr = probe[i][0] - 0.5f;<br>
-      dg = probe[i][1] - 0.5f;<br>
-      db = probe[i][2] - 0.5f;<br>
-      printf("   Delta: %f,%f,%f\n", dr, dg, db);<br>
-      if (dr > dmax) dmax = dr;<br>
-      else if (-dr > dmax) dmax = -dr;<br>
-      if (dg > dmax) dmax = dg;<br>
-      else if (-dg > dmax) dmax = -dg;<br>
-      if (db > dmax) dmax = db;<br>
-      else if (-db > dmax) dmax = -db;<br>
+          pass &= piglit_probe_pixel_rgb(piglit_width*(2*i+1)/((NUM_TESTS+1)*2),<br>
+                          piglit_height/2,<br>
+                          expected);<br>
    }<br>
<br>
-   printf("Max delta: %f\n", dmax);<br>
-<br>
-   if (dmax >= 0.07) // roughly 1/128<br></blockquote><div><br>Wow, that's gotta be the worst approximation to 1/128 I've ever seen.  Glad to see it's getting deleted :)<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

-      return 0;<br>
-   else<br>
-      return 1;<br>
+   return pass;<br>
 }<br>
<br>
 enum piglit_result<br>
<span class="HOEnZb"><font color="#888888">--<br>
1.7.12<br></font></span></blockquote><div><br>With the indentation fixed, this patch is:<br><br>Reviewed-by: Paul Berry <<a href="mailto:stereotype441@gmail.com">stereotype441@gmail.com</a>><br></div></div>