[Piglit] [PATCH] copyteximage: Fix the test to eliminate GL_TEXTURE_1D failures on NVIDIA

Anuj Phogat anuj.phogat at gmail.com
Tue Aug 21 19:17:11 PDT 2012


On Tue, Aug 21, 2012 at 6:28 PM, Brian Paul <brian.e.paul at gmail.com> wrote:
> On Tue, Aug 21, 2012 at 5:32 PM, Anuj Phogat <anuj.phogat at gmail.com> wrote:
>> Draw and probe a QUAD (in place of a LINE) in case of GL_TEXTURE_1D. This
>> fixes the test failures on NVIDIA's proprietary linux drivers. In case of
>> LINE, glReadPixels() misses the relevant pixels by one pixel on NVIDIA.
>>
>> Signed-off-by: Anuj Phogat <anuj.phogat at gmail.com>
>> ---
>> Brian, both these patches (including the one I sent earlier today) resolve
>> separate issues. So, I'm keeping this fix in a separate patch. Let me know
>> if you have any comments on the patches.
>>
>>  tests/texturing/copyteximage.c |   16 +++++-----------
>>  1 files changed, 5 insertions(+), 11 deletions(-)
>>
>> diff --git a/tests/texturing/copyteximage.c b/tests/texturing/copyteximage.c
>> index c8a8492..43bc78b 100644
>> --- a/tests/texturing/copyteximage.c
>> +++ b/tests/texturing/copyteximage.c
>> @@ -442,8 +442,6 @@ piglit_display(void)
>>                 for (i = 0; i < ARRAY_SIZE(test_vectors); i++) {
>>                         GLint x = IMAGE_SIZE * (i + 1);
>>                         GLint y = 0;
>> -                       GLfloat vertices_1d[2][2] = { {x, y},
>> -                                                     {x + IMAGE_SIZE, y} };
>>
>>                         format = test_vectors[i].format;
>>                         expected = (const float*)test_vectors[i].expected;
>> @@ -485,15 +483,11 @@ piglit_display(void)
>>                                        && pass;
>>
>>                                 glEnable(target[j].target);
>> -                               glEnableClientState(GL_VERTEX_ARRAY);
>> -                               glTexCoordPointer(1, GL_FLOAT, 0, texCoords_1d);
>> -                               glVertexPointer(2, GL_FLOAT, 0, vertices_1d);
>> -
>> -                               glDrawArrays(GL_LINES, 0, 2);
>> -                               pass = piglit_probe_pixel_rgba(x, 0, expected)
>> -                                      && pass;
>> -                               pass = piglit_probe_pixel_rgba(x + IMAGE_SIZE - 1,
>> -                                                              0, expected)
>> +                               glTexCoordPointer(2, GL_FLOAT, 0, texCoords_2d);
>> +                               piglit_draw_rect(x, y, IMAGE_SIZE, 1);
>
> Drawing a quad that's one pixel tall is just about as risky as drawing
> a line, in terms of trying to hit specific pixels.  Why not draw a
> taller quad?
>
I'll update my patch with a taller quad.

> Otherwise, see the OpenGL docs I mentioned in my reply to Matt.
> Basically, I think you need to use a 0.375 x/y translation to hit
> specific pixels.
>
> -Brian
Thanks for the reference. It was interesting to know that lines and
points are recommended to be drawn at half integer locations for a
predictable behavior.

>> +                               pass = piglit_probe_rect_rgba(x, y, IMAGE_SIZE,
>> +                                                             1,
>> +                                                             expected)
>>                                        && pass;
>>                                 break;
>>


More information about the Piglit mailing list