[Piglit] [PATCH] Test case for glTexImage2D with depth cube map

Chad Versace chad.versace at linux.intel.com
Wed Nov 23 10:52:49 PST 2011


On 11/23/2011 09:06 AM, Brian Paul wrote:
> On Mon, Nov 21, 2011 at 8:20 PM, Anuj Phogat <anuj.phogat at gmail.com> wrote:
>> From: Anuj Phogat <anuj.phogat at gmail.com>
>>
>> Hi,
>>
>>   I developed this testcase (depth-cube-map) to test depth cube map support on
>>   mesa-dev. It draws a polygon using one of cube map faces as texture. Testing is done
>>   by comparing the polygon's pixel color with texture color.
>>   I would be happy to make any suggested changes/additions to this test case.
>>
>> Thanks
>> Anuj
>>
>> Signed-off-by: Anuj Phogat <anuj.phogat at gmail.com>
>> ---
>>  tests/texturing/depth-cube-map.c |  221 ++++++++++++++++++++++++++++++++++++++
>>  1 files changed, 221 insertions(+), 0 deletions(-)
>>  create mode 100644 tests/texturing/depth-cube-map.c


>> +static GLfloat vertices[12] = {350.0, 50.0, 0.0,
>> +                               350.0, 350.0, 0.0,
>> +                               50.0, 50.0, 0.0,
>> +                               50.0, 350.0, 0.0};
>> +
>> +static GLfloat texCoords[12] = {1.0, 0.0, -1.0,
>> +                               1.0, 1.0, -1.0,
>> +                               0.0, 0.0, -1.0,
>> +                               0.0, 1.0, -1.0};


>> +static void
>> +loadTex(void)
>> +{
>> +       #define height 2
>> +       #define width 2
>> +       int i, j;
>> +       unsigned int face;
>> +
>> +       GLfloat texDepthData[width][height];
>> +       GLfloat texDepthData1[width][height];
>> +       for (i=0; i < width; ++i) {
>> +               for (j=0; j < height; ++j) {
>> +                    texDepthData[i][j] = 1.0;
>> +               }
>> +       }
> 
> I think the test would be better if the texture images weren't all
> solid 1.0 (white).  Maybe make each cube face a different value/depth
> and draw/probe each.

I think the test should also probe each cube face, in order to more fully
cover textureCube's functionality. If I understand correctly the
texCoords array defined above, only the -x face is probed.


>> +       err = glGetError();
>> +       switch (err)
>> +       {
>> +       case GL_INVALID_ENUM:
>> +               printf("GL_INVALID_ENUM\n");
>> +               break;
>> +       case GL_INVALID_VALUE:
>> +               printf("GL_INVALID_VALUE\n");
>> +               break;
>> +       case GL_INVALID_OPERATION:
>> +               printf("GL_INVALID_OPERATION\n");
>> +               break;
>> +       case GL_STACK_OVERFLOW:
>> +               printf("GL_STACK_OVERLFOW\n");
>> +               break;
>> +       case GL_STACK_UNDERFLOW:
>> +               printf("GL_STACK_UNDERFLOW\n");
>> +               break;
>> +       case GL_OUT_OF_MEMORY:
>> +               printf("GL_OUT_OF_MEMORY\n");
>> +               break;
>> +
>> +       }
> 
> I think there's also a piglit utility for looking up GL error strings like this.

Those utilities are piglit_get_gl_error_name() and piglit_check_gl_error(). The block
above should be replaced with:
   piglit_check_gl_error(GL_NO_ERROR, PIGLIT_FAIL);

----
Chad Versace
chad.versace at linux.intel.com


More information about the Piglit mailing list