[Piglit] [PATCH] texture: add a 1:1 linear texture test case

Yuanhan Liu yuanhan.liu at linux.intel.com
Thu Oct 20 01:44:41 PDT 2011


On Wed, Oct 19, 2011 at 09:39:12AM -0700, Eric Anholt wrote:
> On Wed, 19 Oct 2011 11:06:16 +0800, Yuanhan Liu <yuanhan.liu at linux.intel.com> wrote:
> > To test that the 1:1 texture with filter set to linear is sampled
> > correctly.
> > 
> 
> > diff --git a/tests/all.tests b/tests/all.tests
> > index 0248164..0579fc0 100644
> > --- a/tests/all.tests
> > +++ b/tests/all.tests
> > @@ -609,6 +609,7 @@ add_plain_test(glx, 'glx-pixmap-crosscheck')
> >  glx['glx-pixmap-crosscheck'].runConcurrent = True
> >  
> >  texturing = Group()
> > +add_plain_test(texturing, '1-1-linear-texture')
> 
> If the test can be run concurrent (with -auto -fbo), then
> add_concurrent_test means it will basically end up costing no runtime on
> piglit :)
> 
> (I want to generally be doing that for new tests when it's easy, since
> piglit runtime is an issue for all of us.)
> 
> >  add_plain_test(texturing, 'array-texture')
> >  add_plain_test(texturing, 'copytexsubimage')
> >  add_plain_test(texturing, 'copyteximage')
> > diff --git a/tests/texturing/1-1-linear-texture.c b/tests/texturing/1-1-linear-texture.c
> > new file mode 100644
> > index 0000000..b9c2b23
> > --- /dev/null
> > +++ b/tests/texturing/1-1-linear-texture.c
> 
> > +static void * make_tex_data(void)
> > +{
> > +	int i;
> > +	GLubyte *data = malloc(DATA_SIZE);
> > +
> > +	for (i = 0; i < DATA_SIZE; i++) {
> > +		if (i % 4 == 3)
> > +			data[i] = 255;
> > +		else
> > +			data[i] = random() % 256;
> > +	}
> 
> I usually complain about random() in testcases because it means that
> changing other parameters ends up changing the data.  In this case I
> think it's fine, because we want to test high-intensity channels next to
> low-intensity channels in all directions, and it would be trickier to do
> it some other way.
> 
> > +	if (err_count) {
> > +		fprintf(stderr, "Got %d error pixels(%d total), "
> > +			        "just first %d pixels showed\n",
> 
> "shown"  (or maybe "printed") 
> 
> > +				err_count, size / 4,
> > +				err_count > 10 ? 10 : err_count);
> > +	}
> 
> 
> > +	glBegin(GL_QUADS);
> > +	  glTexCoord2f(0.0, 0.0);
> > +	  glVertex2f(-1.0, -1.0);
> > +	  glTexCoord2f(1.0, 0.0);
> > +	  glVertex2f(1.0, -1.0);
> > +	  glTexCoord2f(1.0, 1.0);
> > +	  glVertex2f(1.0,  1.0);
> > +	  glTexCoord2f(0.0, 1.0);
> > +	  glVertex2f(-1.0,  1.0);
> > +	glEnd();
> 
> This could be
> piglit_draw_rect_tex(-1, -1, 2, 2,
>                      0, 0, 1, 1);
> 
> There's just those two comments above ("shown" and add_concurrent_test),
> then you can add:
> 
> Reviewed-by: Eric Anholt <eric at anholt.net>
> 
> Nice testcase!

An updated patch with all your comments except the random() thing applied
sent.

Thanks,
Yuanhan Liu




More information about the Piglit mailing list