[Mesa-dev] [RFC 17/21] mesa: Fix ARB_ES3_compatibility functionality leaks

Nanley Chery nanleychery at gmail.com
Mon Oct 19 15:44:55 PDT 2015


From: Nanley Chery <nanley.g.chery at intel.com>

Stop leaks into GLES1/2 and pre-3.3 GL contexts in all uses.

The extension spec lists OpenGL 3.3 as one of the requirements, so
update the extension table accordingly.

v2. Require 3.3 for GL legacy contexts as well (Chad).

Signed-off-by: Nanley Chery <nanley.g.chery at intel.com>
---
 src/mesa/main/enable.c           | 4 ++--
 src/mesa/main/extensions_table.h | 2 +-
 src/mesa/main/glformats.c        | 2 +-
 src/mesa/main/queryobj.c         | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c
index 42f6799..ee95334 100644
--- a/src/mesa/main/enable.c
+++ b/src/mesa/main/enable.c
@@ -972,7 +972,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
          break;
 
       case GL_PRIMITIVE_RESTART_FIXED_INDEX:
-	 if (!_mesa_is_gles3(ctx) && !ctx->Extensions.ARB_ES3_compatibility)
+	 if (!_mesa_is_gles3(ctx) && !_mesa_has_ARB_ES3_compatibility(ctx))
             goto invalid_enum_error;
          if (ctx->Array.PrimitiveRestartFixedIndex != state) {
             FLUSH_VERTICES(ctx, _NEW_TRANSFORM);
@@ -1582,7 +1582,7 @@ _mesa_IsEnabled( GLenum cap )
          return ctx->Array.PrimitiveRestart;
 
       case GL_PRIMITIVE_RESTART_FIXED_INDEX:
-	 if (!_mesa_is_gles3(ctx) && !ctx->Extensions.ARB_ES3_compatibility) {
+	 if (!_mesa_is_gles3(ctx) && !_mesa_has_ARB_ES3_compatibility(ctx)) {
             goto invalid_enum_error;
          }
          return ctx->Array.PrimitiveRestartFixedIndex;
diff --git a/src/mesa/main/extensions_table.h b/src/mesa/main/extensions_table.h
index 62e0804..760fbe9 100644
--- a/src/mesa/main/extensions_table.h
+++ b/src/mesa/main/extensions_table.h
@@ -4,7 +4,7 @@
 #define ES2 1u
 #define  x ~0u
 EXT(ARB_ES2_compatibility                   , ARB_ES2_compatibility                  , GLL, GLC,  x ,  x , 2009)
-EXT(ARB_ES3_compatibility                   , ARB_ES3_compatibility                  , GLL, GLC,  x ,  x , 2012)
+EXT(ARB_ES3_compatibility                   , ARB_ES3_compatibility                  ,  33,  33,  x ,  x , 2012)
 EXT(ARB_arrays_of_arrays                    , ARB_arrays_of_arrays                   , GLL, GLC,  x ,  x , 2012)
 EXT(ARB_base_instance                       , ARB_base_instance                      , GLL, GLC,  x ,  x , 2011)
 EXT(ARB_blend_func_extended                 , ARB_blend_func_extended                , GLL, GLC,  x ,  x , 2009)
diff --git a/src/mesa/main/glformats.c b/src/mesa/main/glformats.c
index 542dcfc..6b602d8 100644
--- a/src/mesa/main/glformats.c
+++ b/src/mesa/main/glformats.c
@@ -1325,7 +1325,7 @@ _mesa_is_compressed_format(const struct gl_context *ctx, GLenum format)
       return _mesa_is_gles(ctx)
          && ctx->Extensions.OES_compressed_ETC1_RGB8_texture;
    case MESA_FORMAT_LAYOUT_ETC2:
-      return _mesa_is_gles3(ctx) || ctx->Extensions.ARB_ES3_compatibility;
+      return _mesa_is_gles3(ctx) || _mesa_has_ARB_ES3_compatibility(ctx);
    case MESA_FORMAT_LAYOUT_BPTC:
       return _mesa_has_ARB_texture_compression_bptc(ctx);
    case MESA_FORMAT_LAYOUT_ASTC:
diff --git a/src/mesa/main/queryobj.c b/src/mesa/main/queryobj.c
index 9836685..48fd571 100644
--- a/src/mesa/main/queryobj.c
+++ b/src/mesa/main/queryobj.c
@@ -176,7 +176,7 @@ get_query_binding_point(struct gl_context *ctx, GLenum target, GLuint index)
       else
          return NULL;
    case GL_ANY_SAMPLES_PASSED_CONSERVATIVE:
-      if (ctx->Extensions.ARB_ES3_compatibility
+      if (_mesa_has_ARB_ES3_compatibility(ctx)
           || (ctx->API == API_OPENGLES2 && ctx->Version >= 30))
          return &ctx->Query.CurrentOcclusionObject;
       else
-- 
2.6.1



More information about the mesa-dev mailing list