[Piglit] [PATCH 6/7] trinity-fp1: Convert this test to using piglit_probe_pixel_rgb.

Ian Romanick idr at freedesktop.org
Fri May 20 01:58:08 PDT 2011


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 05/20/2011 04:09 AM, Eric Anholt wrote:
> Less worrying console output when it passes.
> ---
>  tests/shaders/trinity-fp1.c |   29 +++++++----------------------
>  1 files changed, 7 insertions(+), 22 deletions(-)
> 
> diff --git a/tests/shaders/trinity-fp1.c b/tests/shaders/trinity-fp1.c
> index 5568e1b..70eb0a6 100644
> --- a/tests/shaders/trinity-fp1.c
> +++ b/tests/shaders/trinity-fp1.c
> @@ -111,40 +111,25 @@ static void DoFrame(void)
>  	glutSwapBuffers();
>  }
>  
> -static int DoTest( void )
> +static bool
> +DoTest( void )
>  {
>  	static const float expected[2][3] = {
>  		{ 0.30, 0.23, 0.40 },
>  		{ 0.24, 0.29, 0.40 }
>  	};
>  	int i;
> -	GLfloat dmax = 0;
> +	bool pass = true;
>  
>  	glReadBuffer( GL_FRONT );
>  
>  	for(i = 0; i < 2; ++i) {
> -		GLfloat probe[4];
> -		GLfloat delta[3];
> -		int j;
> -
> -		glReadPixels(piglit_width*(2*i+1)/4, piglit_height/2, 1, 1, GL_RGBA, GL_FLOAT, probe);
> -		printf("Probe: %f,%f,%f\n", probe[0], probe[1], probe[2]);
> -
> -		for(j = 0; j < 3; ++j) {
> -			delta[j] = probe[j] - expected[i][j];
> -			if (delta[j] > dmax) dmax = delta[j];
> -			else if (-delta[j] > dmax) dmax = -delta[j];
> -		}
> -
> -		printf("   Delta: %f,%f,%f\n", delta[0], delta[1], delta[2]);
> +		pass = pass && piglit_probe_pixel_rgb(piglit_width*(2*i+1)/4,
> +						      piglit_height/2,
> +						      expected[i]);

Usually we do 'piglit_probe() && pass' so that probes aren't
short-circuited after the first failure.  Is there a reason to not do
that here?

>  	}
>  
> -	printf("Max delta: %f\n", dmax);
> -
> -	if (dmax >= 0.02)
> -		return 0;
> -	else
> -		return 1;
> +	return pass;
>  }
>  
>  
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iEYEARECAAYFAk3WLSAACgkQX1gOwKyEAw+C7QCeN/lPTMSpuxTXsWRhIalkwcxW
3CUAmwUijIjUSXGLWzORNQYYS6pXbTbw
=xizp
-----END PGP SIGNATURE-----


More information about the Piglit mailing list