On 03/23/2015 11:07 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.

Also call glWindowPos2i, to ensure the texture coordinates are actually put
into the raster position state.

V2:
  - Add a glWindowPos2i call, to avoid undefined behaviour.
  - Use the bottom left texel, to detect issues copying over the raster 
position.
  - Change the pixels passed into glDrawPixels, to ensure each quadrant of
the texture is visibly different.
  - Add explanatory comment about the texture coordinates.

Reviewed-by: Brian Paul <[email protected]> (v1)
---
  tests/general/draw-pixel-with-texture.c | 10 ++++++----
  1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/tests/general/draw-pixel-with-texture.c 
b/tests/general/draw-pixel-with-texture.c
index c03131e..dc9f213 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,
+               0, 0, 1, 1,     0, 1, 1, 1,
+               0, 1, 0, 1,     1, 0, 0, 1,
         };
         GLfloat *pixels;
         GLfloat expected[4] = {0.2, 0, 0, 1};
@@ -53,13 +53,15 @@ 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);
+       // This is meant to grab the bottom left texel, at {1, 0, 0, 1}
+       glTexCoord2f(0.75, 0.75);

The comment doesn't match the code. For a 2x2 texture, the texcoord at (0.75, 0.75) would sample the upper-right texel. What does the {1,0,0,1} part mean?

BTW, your patch doesn't apply cleanly to the current version. The "-" lines in your patch have spaces for indentation instead of tabs.


+       glWindowPos2i(0, 0);
         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;
         }




_______________________________________________
Piglit mailing list
[email protected]
https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.freedesktop.org_mailman_listinfo_piglit&d=AwIGaQ&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=T0t4QG7chq2ZwJo6wilkFznRSFy-8uDKartPGbomVj8&m=yYpQyc4adHg9NgaBzGd9iwTxc2ypZID899DA7Ya4HmU&s=0oFeVktXWwmRSSTuqtxKqAevJ5XQ2DKzxQxsjb-2bBg&e=


_______________________________________________
Piglit mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/piglit

Reply via email to