summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Forbes <chrisf@ijw.co.nz>2012-08-25 17:54:25 +1200
committerChad Versace <chad.versace@linux.intel.com>2012-09-04 16:03:00 -0700
commit6a0ff32f88cc690591220f750c4576f69f76e375 (patch)
treef2a7eaaeb7a115f4c50aec99db94a8a7b4e63131
parent7b8f3e37db5922c6862fe1fa32fde61bae9646fb (diff)
Convert some raw glReadPixels to use piglit probes
V2: don't introduce bogus indentation; use real bools Reviewed-by: Paul Berry <stereotype441@gmail.com>
-rw-r--r--tests/shaders/fp-incomplete-tex.c45
-rw-r--r--tests/shaders/fp-kil.c45
-rw-r--r--tests/texturing/crossbar.c34
3 files changed, 26 insertions, 98 deletions
diff --git a/tests/shaders/fp-incomplete-tex.c b/tests/shaders/fp-incomplete-tex.c
index 66375c1cf..87a66e387 100644
--- a/tests/shaders/fp-incomplete-tex.c
+++ b/tests/shaders/fp-incomplete-tex.c
@@ -128,54 +128,27 @@ static const struct {
}
};
-static int DoTest( void )
+static bool DoTest( void )
{
- int idx;
- GLfloat dmax;
+ int idx = 0;
+ bool pass = true;
- dmax = 0;
-
- idx = 0;
while(Probes[idx].name) {
- GLfloat probe[4];
- GLfloat delta[4];
- int i;
-
- glReadPixels((int)(Probes[idx].x * piglit_width / 3),
- (int)(Probes[idx].y * piglit_height / 2),
- 1, 1,
- GL_RGBA, GL_FLOAT, probe);
-
- printf("%20s (%3.1f,%3.1f): %f,%f,%f,%f",
- Probes[idx].name,
- Probes[idx].x, Probes[idx].y,
- probe[0], probe[1], probe[2], probe[3]);
-
- for(i = 0; i < 4; ++i) {
- delta[i] = probe[i] - Probes[idx].expected[i];
-
- if (delta[i] > dmax) dmax = delta[i];
- else if (-delta[i] > dmax) dmax = -delta[i];
- }
-
- printf(" Delta: %f,%f,%f,%f\n", delta[0], delta[1], delta[2], delta[3]);
-
+ pass = piglit_probe_pixel_rgba(
+ (int)(Probes[idx].x * piglit_width / 3),
+ (int)(Probes[idx].y * piglit_height / 2),
+ Probes[idx].expected) && pass;
idx++;
}
- printf("Max delta: %f\n", dmax);
-
- if (dmax >= 0.02)
- return 0;
- else
- return 1;
+ return pass;
}
enum piglit_result
piglit_display(void)
{
- int pass;
+ bool pass;
DoFrame();
pass = DoTest();
diff --git a/tests/shaders/fp-kil.c b/tests/shaders/fp-kil.c
index d82b59e5e..cb25e5fe2 100644
--- a/tests/shaders/fp-kil.c
+++ b/tests/shaders/fp-kil.c
@@ -203,53 +203,26 @@ static const struct {
}
};
-static int DoTest( void )
+static bool DoTest( void )
{
- int idx;
- GLfloat dmax;
+ int idx = 0;
+ bool pass = true;
- dmax = 0;
-
- idx = 0;
while(Probes[idx].name) {
- GLfloat probe[4];
- GLfloat delta[4];
- int i;
-
- glReadPixels((int)(Probes[idx].x*piglit_width/2),
- (int)(Probes[idx].y*piglit_height/2),
- 1, 1,
- GL_RGBA, GL_FLOAT, probe);
-
- printf("%20s (%3.1f,%3.1f): %f,%f,%f,%f",
- Probes[idx].name,
- Probes[idx].x, Probes[idx].y,
- probe[0], probe[1], probe[2], probe[3]);
-
- for(i = 0; i < 4; ++i) {
- delta[i] = probe[i] - Probes[idx].expected[i];
-
- if (delta[i] > dmax) dmax = delta[i];
- else if (-delta[i] > dmax) dmax = -delta[i];
- }
-
- printf(" Delta: %f,%f,%f,%f\n", delta[0], delta[1], delta[2], delta[3]);
-
+ pass = piglit_probe_pixel_rgba(
+ (int)(Probes[idx].x*piglit_width/2),
+ (int)(Probes[idx].y*piglit_height/2),
+ Probes[idx].expected) && pass;
idx++;
}
- printf("Max delta: %f\n", dmax);
-
- if (dmax >= 0.02)
- return 0;
- else
- return 1;
+ return pass;
}
enum piglit_result
piglit_display(void)
{
- int pass;
+ bool pass;
piglit_gen_ortho_projection(0.0, 2.0, 0.0, 2.0, -2.0, 6.0, GL_FALSE);
diff --git a/tests/texturing/crossbar.c b/tests/texturing/crossbar.c
index 497ff3199..9bdaae8c0 100644
--- a/tests/texturing/crossbar.c
+++ b/tests/texturing/crossbar.c
@@ -110,37 +110,19 @@ static void DoFrame( void )
}
-static int DoTest( void )
+static bool DoTest( void )
{
+ const static float expected[] = {0.5f, 0.5f, 0.5f};
+ bool pass = true;
int i;
- GLfloat probe[NUM_TESTS+1][4];
- GLfloat dr, dg, db;
- GLfloat dmax;
- glReadBuffer( GL_BACK );
-
- dmax = 0;
for( i = 0; i <= NUM_TESTS; ++i ) {
- glReadPixels(piglit_width*(2*i+1)/((NUM_TESTS+1)*2), piglit_height/2, 1, 1, GL_RGBA, GL_FLOAT, probe[i]);
- printf("Probe %i: %f,%f,%f\n", i, probe[i][0], probe[i][1], probe[i][2]);
- dr = probe[i][0] - 0.5f;
- dg = probe[i][1] - 0.5f;
- db = probe[i][2] - 0.5f;
- printf(" Delta: %f,%f,%f\n", dr, dg, db);
- if (dr > dmax) dmax = dr;
- else if (-dr > dmax) dmax = -dr;
- if (dg > dmax) dmax = dg;
- else if (-dg > dmax) dmax = -dg;
- if (db > dmax) dmax = db;
- else if (-db > dmax) dmax = -db;
+ pass = piglit_probe_pixel_rgb(piglit_width*(2*i+1)/((NUM_TESTS+1)*2),
+ piglit_height/2,
+ expected) && pass;
}
- printf("Max delta: %f\n", dmax);
-
- if (dmax >= 0.07) // roughly 1/128
- return 0;
- else
- return 1;
+ return pass;
}
enum piglit_result
@@ -151,7 +133,7 @@ piglit_display(void)
piglit_present_results();
return PIGLIT_PASS;
} else {
- int success, retry;
+ bool success, retry;
printf("\nFirst frame\n-----------\n");
DoFrame();