[Piglit] [PATCH 2/2] gl-3.0: Add test for invalid buffer parameter to glClearBuffer

Ian Romanick idr at freedesktop.org
Wed Nov 2 13:10:18 PDT 2011


On 11/01/2011 03:35 PM, Brian Paul wrote:
> On Tue, Nov 1, 2011 at 4:00 PM, Ian Romanick<idr at freedesktop.org>  wrote:
> ...
>> +#define string_enum(x) { # x, x }
>> +
>> +struct testv {
>> +       const char *name;
>> +       GLenum value;
>> +};
>> +
>> +void piglit_init(int argc, char **argv)
>> +{
>> +       /* Try a bunch of enums that someone might try by accident.
>> +        */
>> +       static const struct testv test_vectors[] = {
>> +               string_enum(GL_DEPTH_BUFFER),
>> +               string_enum(GL_STENCIL_BUFFER),
> ...
>
> It seems we implement GLenum->string mapping over and over again in
> different piglit tests.  It would be nice if we had a
> piglit_enum_string() helper that'd do this for us.  We could probably
> use a python script to extract the token #defines from glew.h and
> generate something like Mesa's enums.c

That probably would be useful.  GLU used to have a function for that, 
but it's safe to assume that it's so out of date as to be useless.  In 
this case, I just wanted to associate a name with the test data.  It 
just happened that all the values I ended up using were GLenum values.



More information about the Piglit mailing list