[Mesa-dev] [RFC 06/21] mesa/extensions: Create _mesa_extension_supported()
Emil Velikov
emil.l.velikov at gmail.com
Thu Oct 22 03:19:10 PDT 2015
On 19 October 2015 at 23:36, Nanley Chery <nanleychery at gmail.com> wrote:
> From: Nanley Chery <nanley.g.chery at intel.com>
>
> Create a function which determines if an extension is supported in the
> current context.
>
> Signed-off-by: Nanley Chery <nanley.g.chery at intel.com>
> ---
> src/mesa/main/extensions.c | 17 +++++++++++++++++
> 1 file changed, 17 insertions(+)
>
> diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
> index 390e026..7137bc9 100644
> --- a/src/mesa/main/extensions.c
> +++ b/src/mesa/main/extensions.c
> @@ -423,6 +423,23 @@ typedef unsigned short extension_index;
>
>
> /**
> + * Given an extension enum, return whether or not the extension is supported
> + * dependent on the following factors:
> + * There's driver support and the OpenGL/ES version is at least that
> + * specified in the extension_table.
> + */
> +static inline bool
> +_mesa_extension_supported(const struct gl_context *ctx, extension_index ei)
> +{
> + const bool *base = (bool *) &ctx->Extensions;
> + const struct extension *i = extension_table + ei;
> + const uint8_t api_set = 1 << ctx->API;
> + return (i->api_set & api_set) &&
> + (ctx->Version >= i->version[ctx->API]) &&
> + base[i->offset];
Bikeshed: I realise that you're copying most of these, but wouldn't it
be better if we use more common/intuitive variable names ?
ei -> i or idx
i -> ext
-Emil
More information about the mesa-dev
mailing list