[Piglit] [PATCH] Check the max point size the driver supported and adjust it accordingly.

Brian Paul brianp at vmware.com
Mon Feb 20 07:23:55 PST 2012


On 02/19/2012 06:55 PM, Jian Zhao wrote:
> Signed-off-by: Jian Zhao<jian.j.zhao at intel.com>
> ---
>   tests/fbo/fbo-gl_pointcoord.c |   13 ++++++++++---
>   1 files changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/tests/fbo/fbo-gl_pointcoord.c b/tests/fbo/fbo-gl_pointcoord.c
> index 8db6ad4..0bfd283 100644
> --- a/tests/fbo/fbo-gl_pointcoord.c
> +++ b/tests/fbo/fbo-gl_pointcoord.c
> @@ -47,6 +47,7 @@ static const char fs_text[] =
>   	;
>   static GLuint prog;
>   static GLuint fb, rb;
> +static GLuint testPoint_x, testPoint_y;
>
>   static const float green[] = { 0.0, 1.0, 0.0, 1.0 };
>   static const float black[] = { 0.0, 0.0, 0.0, 1.0 };
> @@ -64,8 +65,8 @@ piglit_display(void)
>
>   	glBindFramebuffer(GL_READ_FRAMEBUFFER, fb);
>   	pass = piglit_probe_pixel_rgb(0, 0, black)&&  pass;
> -	pass = piglit_probe_pixel_rgb(18, 18, green)&&  pass;
> -	pass = piglit_probe_pixel_rgb(18, 81, black)&&  pass;
> +	pass = piglit_probe_pixel_rgb(testPoint_x, testPoint_x, green)&&  pass;

Here and below, it looks a little weird to use testPoint_x to indicate 
the Y coordinate.


> +	pass = piglit_probe_pixel_rgb(testPoint_x, testPoint_y - 1, black)&&  pass;
>
>   	/* Draw the point out if want to have a look. */
>   	if (!piglit_automatic){
> @@ -84,13 +85,19 @@ void
>   piglit_init(int argc, char **argv)
>   {
>   	GLuint vs, fs;
> -	int PointSize = 64;
> +	int PointSize;
> +	int point_size_limits[2];
>
>   	piglit_require_extension("GL_ARB_point_sprite");
>   	piglit_require_extension("GL_ARB_framebuffer_object");
>
> +	glGetIntegerv(GL_ALIASED_POINT_SIZE_RANGE, point_size_limits);
> +
> +	PointSize = point_size_limits[1]>= 64 ? 64 : point_size_limits[1];
>   	glEnable(GL_POINT_SPRITE_ARB);
>   	glPointSize(PointSize);
> +	testPoint_x = ( 100 - PointSize ) / 2;
> +	testPoint_y = 100 - testPoint_x ;

Instead of 100, use piglit_width or piglit_height.

I'd prefer to see the X and Y probe coordinates computed independently 
and moved into the piglit_display() function.

Last year, I found that quite a few piglit tests were failing on 
Windows because the default window size used by the tests was too 
small and Windows was changing the width (and the piglit test code 
didn't notice).  Our tests should be tolerant of window size changes 
when possible.


>   	piglit_require_vertex_shader();
>   	piglit_require_fragment_shader();

-Brian


More information about the Piglit mailing list