[Piglit] [PATCH] Adjust draw-pixel-with-texture to ensure glTexCoord is taken into account.

Brian Paul brianp at vmware.com
Mon Mar 23 09:33:28 PDT 2015


On 03/21/2015 11:49 PM, Matthew Dawson wrote:
> The old version of the test assumed the glTexCoord call was being properly
> used in the system.  However, at least in mesa, it is easy for an
> implementation to ignore the given coordinate.  Thus setup the texture and
> texture coordinate to ensure it is respected.
> ---
> As before, I don't have commit rights.  I think this test case is right, but I
> don't have a conforming OpenGL implementation to double check.
>
>   tests/general/draw-pixel-with-texture.c | 8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/tests/general/draw-pixel-with-texture.c b/tests/general/draw-
> pixel-with-texture.c
> index c03131e..ade2d86 100644
> --- a/tests/general/draw-pixel-with-texture.c
> +++ b/tests/general/draw-pixel-with-texture.c
> @@ -39,8 +39,8 @@ piglit_display(void)
>   {
>          GLboolean pass = GL_TRUE;
>          GLfloat tex_data[2 * 2 * 4] = {
> -               1, 0, 0, 1,     1, 0, 0, 1,
> -               1, 0, 0, 1,     1, 0, 0, 1,
> +               1, 0, 0, 1,     0, 1, 1, 1,
> +               0, 1, 0, 1,     0, 0, 1, 1,
>          };
>          GLfloat *pixels;
>          GLfloat expected[4] = {0.2, 0, 0, 1};
> @@ -53,13 +53,13 @@ piglit_display(void)
>          glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
>          glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
>
> -       glTexCoord2f(0.5, 0.5);
> +       glTexCoord2f(0.25, 0.25);

Maybe put a comment on that call to the effect of "sample texel (0,0)" 
just to be explicit.


>          glEnable(GL_TEXTURE_2D);
>
>          for (i = 0; i < SCREEN_SIZE_IN_PIXELS; i += 4) {
>                  pixels[i + 0] = 0.2;
>                  pixels[i + 1] = 1;
> -               pixels[i + 2] = 0;
> +               pixels[i + 2] = 0.4;
>                  pixels[i + 3] = 1;
>          }
>

Reviewed-by: Brian Paul <brianp at vmware.com>

Works fine w/ nvidia's driver, but fails with Mesa swrast.  swrast 
should pass since I remember implementing this at one point but I don't 
have time to investigate right now.

-Brian



More information about the Piglit mailing list