[Mesa-dev] [RFC 07/21] mesa/extensions: Use _mesa_extension_supported()

Chad Versace chad.versace at intel.com
Thu Oct 22 11:15:14 PDT 2015


On Mon 19 Oct 2015, Nanley Chery wrote:
> From: Nanley Chery <nanley.g.chery at intel.com>
> 
> Replace open-coded checks for extension support with
> _mesa_extension_supported().
> 
> Signed-off-by: Nanley Chery <nanley.g.chery at intel.com>
> ---
>  src/mesa/main/extensions.c       | 54 ++++++++--------------------------------
>  src/mesa/main/extensions_table.h |  6 ++---
>  2 files changed, 14 insertions(+), 46 deletions(-)
> 
> diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
> index 7137bc9..5d2eb1d 100644
> --- a/src/mesa/main/extensions.c
> +++ b/src/mesa/main/extensions.c
> @@ -49,8 +49,6 @@ enum {
>     GL  = (1 << API_OPENGL_COMPAT) | (1 << API_OPENGL_CORE),
>     ES1 = 1 << API_OPENGLES,
>     ES2 = 1 << API_OPENGLES2,
> -   ES3 = 1 << (API_OPENGL_LAST + 1),
> -   ES31 = 1 << (API_OPENGL_LAST + 2),

I like the removal of the ES3 and ES31 tokens. There are only 4 GL APIs
(compat, core, es1, and es2), and the enum now better reflects that.

[...]

> @@ -570,25 +558,15 @@ _mesa_make_extension_string(struct gl_context *ctx)
>  GLuint
>  _mesa_get_extension_count(struct gl_context *ctx)
>  {

[...]

>     /* only count once */
>     if (ctx->Extensions.Count != 0)
>        return ctx->Extensions.Count;

Ouch... that looks like a race condition that needs fixing.

> diff --git a/src/mesa/main/extensions_table.h b/src/mesa/main/extensions_table.h
> index 24a0908..fecb402 100644
> --- a/src/mesa/main/extensions_table.h
> +++ b/src/mesa/main/extensions_table.h
> @@ -167,7 +167,7 @@ EXT(EXT_rescale_normal                      , dummy_true
>  EXT(EXT_secondary_color                     , dummy_true                             , GLL            ,  0,  0,  0,  0, 1999)
>  EXT(EXT_separate_shader_objects             , dummy_true                             ,            ES2 ,  0,  0,  0,  0, 2013)
>  EXT(EXT_separate_specular_color             , dummy_true                             , GLL            ,  0,  0,  0,  0, 1997)
> -EXT(EXT_shader_integer_mix                  , EXT_shader_integer_mix                 , GL       | ES3 ,  0,  0,  0,  0, 2013)
> +EXT(EXT_shader_integer_mix                  , EXT_shader_integer_mix                 , GL       | ES2 ,  0,  0,  0, 30, 2013)
>  EXT(EXT_shadow_funcs                        , ARB_shadow                             , GLL            ,  0,  0,  0,  0, 2002)
>  EXT(EXT_stencil_two_side                    , EXT_stencil_two_side                   , GLL            ,  0,  0,  0,  0, 2001)
>  EXT(EXT_stencil_wrap                        , dummy_true                             , GLL            ,  0,  0,  0,  0, 2002)
> @@ -206,7 +206,7 @@ EXT(EXT_transform_feedback                  , EXT_transform_feedback
>  EXT(EXT_unpack_subimage                     , dummy_true                             ,            ES2 ,  0,  0,  0,  0, 2011)
>  EXT(EXT_vertex_array_bgra                   , EXT_vertex_array_bgra                  , GL             ,  0,  0,  0,  0, 2008)
>  EXT(EXT_vertex_array                        , dummy_true                             , GLL            ,  0,  0,  0,  0, 1995)
> -EXT(EXT_color_buffer_float                  , dummy_true                             ,            ES3 ,  0,  0,  0,  0, 2013)
> +EXT(EXT_color_buffer_float                  , dummy_true                             ,            ES2 ,  0,  0,  0, 30, 2013)
>  
>  
>  EXT(OES_blend_equation_separate             , EXT_blend_equation_separate            ,      ES1       ,  0,  0,  0,  0, 2009)
> @@ -250,7 +250,7 @@ EXT(OES_texture_float_linear                , OES_texture_float_linear
>  EXT(OES_texture_half_float                  , OES_texture_half_float                 ,            ES2 ,  0,  0,  0,  0, 2005)
>  EXT(OES_texture_half_float_linear           , OES_texture_half_float_linear          ,            ES2 ,  0,  0,  0,  0, 2005)
>  EXT(OES_texture_mirrored_repeat             , dummy_true                             ,      ES1       ,  0,  0,  0,  0, 2005)
> -EXT(OES_texture_storage_multisample_2d_array, ARB_texture_multisample                ,           ES31 ,  0,  0,  0,  0, 2014)
> +EXT(OES_texture_storage_multisample_2d_array, ARB_texture_multisample                ,            ES2 ,  0,  0,  0, 31, 2014)
>  EXT(OES_texture_npot                        , ARB_texture_non_power_of_two           ,      ES1 | ES2 ,  0,  0,  0,  0, 2005)
>  EXT(OES_vertex_array_object                 , dummy_true                             ,      ES1 | ES2 ,  0,  0,  0,  0, 2010)

This patch looks good to me. Looking forward to v2 of the series.


More information about the mesa-dev mailing list