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

Brian Paul brian.e.paul at gmail.com
Tue Nov 1 15:35:16 PDT 2011


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

-Brian


More information about the Piglit mailing list