[Mesa-dev] [PATCH 1/9] mesa: Handle common extension checks with more compact code

Ian Romanick idr at freedesktop.org
Sat May 20 00:32:07 UTC 2017


On 05/19/2017 05:07 PM, Ilia Mirkin wrote:
> On Fri, May 19, 2017 at 7:29 PM, Ian Romanick <idr at freedesktop.org> wrote:
>> I missed that glsl_parser_extras.cpp has its own implementation of the
>> has_XXX_foo() functions that take the API and version as explicit
>> parameters.  Your patch predates that change.  There's room for some
>> modest savings there too.
> 
> The main thing about those functions is that they have to be
> out-of-line, as they're invoked via function pointer. Each one can be
> cut down a little using your approach of statically looking at the cap
> restrictions, but I don't think inlining can work. [I added that code
> to (a) add "permission" checks to enable extensions in glsl and (b)
> remove the duplication of adding #defines for all the ext names.]

Right.  I think there's two approaches to try.  The least intrusive is
to try some of these tricks in the existing functions.  The more
intrusive would be to generate the data into the table and modify
_mesa_glsl_extension::compatible_with_state to use the data instead of
calling the function.

I'm leaning towards the latter, but I haven't decided how I'd want to
generate the data.  The method used by other users of
main/extensions_table.h won't work because we only want a subset of
extensions.  Hmm...

>   -ilia



More information about the mesa-dev mailing list