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

Zhao, Jian J jian.j.zhao at intel.com
Mon Feb 20 16:55:49 PST 2012


> -----Original Message-----
> From: Brian Paul [mailto:brianp at vmware.com]
> Sent: Monday, February 20, 2012 11:24 PM
> To: Zhao, Jian J
> Cc: piglit at lists.freedesktop.org; yuanhan.liu at linux.intel.com
> Subject: Re: [PATCH] Check the max point size the driver supported and adjust
> it accordingly.
> 
> 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.

OK. I will change to use testPoint_y for 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.

Yes. I just catch this after I send out the patch. 
> 
> I'd prefer to see the X and Y probe coordinates computed independently
> and moved into the piglit_display() function.

OK. Will do it. 
I will send out the patch later. 

Best regards
zhaojian

> 
> 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