[Piglit] [PATCH 4/4] generators: Add a simple generator for enabled and disabled defines

Dylan Baker baker.dylan.c at gmail.com
Tue Apr 12 19:07:30 UTC 2016


Quoting Ilia Mirkin (2016-04-12 08:08:46)
> On Tue, Apr 12, 2016 at 3:49 AM, Dylan Baker <baker.dylan.c at gmail.com> wrote:
> > +/* This is a generated test, do not edit
> > + * Generated by gen_extensions_defined.py
> > + *
> > + * [config]
> > + * expect_result: pass
> > + * glsl_version: ${version.print_float()}
> > + * require_extensions: !${extension} ${' '.join(extra_extensions)}
> > + * [end config]
> > + */
> > +
> > +#version ${str(version)}
> > +% for ext in extra_extensions:
> > +  #extension ${ext} : require
> > +% endfor
> > +
> > +#if defined ${extension}
> > +#    error ${extension} is defined, but should not be
> > +#endif
> > +
> > +float foo() { return 0.0; }
> 
> [Let's try again, with trimming... stupid phone.]
> 
> This only tests for the extension being not defined. It doesn't test
> for one still being able to enable the functionality with
> 
> #extension foo: require

I'm going to ask a noob question here because I'm still trying to get my
head around all of this preprocessor stuff. That template should look
something like:

// [config]
// expect_result: fail
// glsl_version ${version.print_float()}
// require_extensions: !${extension} ${' '.join(extra_extensions)}
// [end config]

#version ${str(version)}
% for ext in extra_extensions:
  #extension ${ext} : require
% endfor
#extension ${extension} : require

float foo() { return 0.0; }

> 
> You should add a second disabled test which verifies that this errors
> out. (:enable and :warn will not error out if the ext isn't there).
> 
> Furthermore, if you want to be _really_ correct, various extensions
> have various version requirements. One should ensure that they go away
> when the #version goes too low. That may be excessive though.

That wouldn't be too hard to add, but it does seem a little excessive.
I'll spin a v2 with the extra test.

> 
>   -ilia
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: signature
URL: <https://lists.freedesktop.org/archives/piglit/attachments/20160412/093c1ac3/attachment.sig>


More information about the Piglit mailing list