[Mesa-dev] [RFC 13/21] mesa: Fix EXT_texture_compression_s3tc functionality leaks

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


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

Stop leaks into the following contexts:
   * GLES 1 in _mesa_get_compressed_formats() and lookup_view_class().
   * GL legacy 1.0 in all uses.

The extension spec lists 1.1 as required for OpenGL and Rev 1.6 of the
extension adds GLES 2.0.25 and 3.0.2 dependencies, so update the
extension table accordingly.

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

diff --git a/src/mesa/main/extensions_table.h b/src/mesa/main/extensions_table.h
index 7fe4546..3729d22 100644
--- a/src/mesa/main/extensions_table.h
+++ b/src/mesa/main/extensions_table.h
@@ -184,7 +184,7 @@ EXT(ANGLE_texture_compression_dxt3          , ANGLE_texture_compression_dxt
 EXT(ANGLE_texture_compression_dxt5          , ANGLE_texture_compression_dxt          , GLL, GLC, ES1, ES2, 2011)
 EXT(EXT_texture_compression_latc            , EXT_texture_compression_latc           , GLL,  x ,  x ,  x , 2006)
 EXT(EXT_texture_compression_rgtc            , ARB_texture_compression_rgtc           , GLL, GLC,  x ,  x , 2004)
-EXT(EXT_texture_compression_s3tc            , EXT_texture_compression_s3tc           , GLL, GLC,  x ,  x , 2000)
+EXT(EXT_texture_compression_s3tc            , EXT_texture_compression_s3tc           ,  11, GLC,  x , ES2, 2000)
 EXT(EXT_texture_cube_map                    , ARB_texture_cube_map                   , GLL,  x ,  x ,  x , 2001)
 EXT(EXT_texture_edge_clamp                  , dummy_true                             , GLL,  x ,  x ,  x , 1997)
 EXT(EXT_texture_env_add                     , dummy_true                             , GLL,  x ,  x ,  x , 1999)
diff --git a/src/mesa/main/glformats.c b/src/mesa/main/glformats.c
index 3ad9e3c..5610de2 100644
--- a/src/mesa/main/glformats.c
+++ b/src/mesa/main/glformats.c
@@ -1312,7 +1312,7 @@ _mesa_is_compressed_format(const struct gl_context *ctx, GLenum format)
       } else {
          return _mesa_is_desktop_gl(ctx)
             && ctx->Extensions.EXT_texture_sRGB
-            && ctx->Extensions.EXT_texture_compression_s3tc;
+            && _mesa_has_EXT_texture_compression_s3tc(ctx);
       }
    case MESA_FORMAT_LAYOUT_FXT1:
       return _mesa_has_3DFX_texture_compression_FXT1(ctx);
diff --git a/src/mesa/main/texcompress.c b/src/mesa/main/texcompress.c
index 8ea7fe9..7a6b538 100644
--- a/src/mesa/main/texcompress.c
+++ b/src/mesa/main/texcompress.c
@@ -296,7 +296,7 @@ _mesa_get_compressed_formats(struct gl_context *ctx, GLint *formats)
       }
    }
 
-   if (ctx->Extensions.EXT_texture_compression_s3tc) {
+   if (_mesa_has_EXT_texture_compression_s3tc(ctx)) {
       if (formats) {
          formats[n++] = GL_COMPRESSED_RGB_S3TC_DXT1_EXT;
          formats[n++] = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT;
diff --git a/src/mesa/main/textureview.c b/src/mesa/main/textureview.c
index 04b7d73..1ac46d6 100644
--- a/src/mesa/main/textureview.c
+++ b/src/mesa/main/textureview.c
@@ -176,7 +176,7 @@ lookup_view_class(const struct gl_context *ctx, GLenum internalformat)
          return compatible_internal_formats[i].view_class;
    }
 
-   if (ctx->Extensions.EXT_texture_compression_s3tc &&
+   if (_mesa_has_EXT_texture_compression_s3tc(ctx) &&
        ctx->Extensions.EXT_texture_sRGB) {
       for (i = 0; i < ARRAY_SIZE(s3tc_compatible_internal_formats); i++) {
          if (s3tc_compatible_internal_formats[i].internal_format
-- 
2.6.1



More information about the mesa-dev mailing list