[Mesa-dev] [RFC 16/21] mesa: Fix ARB_texture_compression_bptc functionality leaks

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


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

Stop leaks into the following contexts:
   * GLES in _mesa_target_can_be_compressed().
   * Pre-3.1 GL legacy versions in all uses.

The extension spec lists OpenGL 3.1 as required, 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        | 3 +--
 src/mesa/main/teximage.c         | 2 +-
 3 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/mesa/main/extensions_table.h b/src/mesa/main/extensions_table.h
index cf6eed7..62e0804 100644
--- a/src/mesa/main/extensions_table.h
+++ b/src/mesa/main/extensions_table.h
@@ -93,7 +93,7 @@ EXT(ARB_texture_buffer_object               , ARB_texture_buffer_object
 EXT(ARB_texture_buffer_object_rgb32         , ARB_texture_buffer_object_rgb32        ,  x , GLC,  x ,  x , 2009)
 EXT(ARB_texture_buffer_range                , ARB_texture_buffer_range               ,  x , GLC,  x ,  x , 2012)
 EXT(ARB_texture_compression                 , dummy_true                             , GLL,  x ,  x ,  x , 2000)
-EXT(ARB_texture_compression_bptc            , ARB_texture_compression_bptc           , GLL, GLC,  x ,  x , 2010)
+EXT(ARB_texture_compression_bptc            , ARB_texture_compression_bptc           ,  31, GLC,  x ,  x , 2010)
 EXT(ARB_texture_compression_rgtc            , ARB_texture_compression_rgtc           , GLL, GLC,  x ,  x , 2004)
 EXT(ARB_texture_cube_map                    , ARB_texture_cube_map                   , GLL,  x ,  x ,  x , 1999)
 EXT(ARB_texture_cube_map_array              , ARB_texture_cube_map_array             , GLL, GLC,  x ,  x , 2009)
diff --git a/src/mesa/main/glformats.c b/src/mesa/main/glformats.c
index 9134d7d..542dcfc 100644
--- a/src/mesa/main/glformats.c
+++ b/src/mesa/main/glformats.c
@@ -1327,8 +1327,7 @@ _mesa_is_compressed_format(const struct gl_context *ctx, GLenum format)
    case MESA_FORMAT_LAYOUT_ETC2:
       return _mesa_is_gles3(ctx) || ctx->Extensions.ARB_ES3_compatibility;
    case MESA_FORMAT_LAYOUT_BPTC:
-      return _mesa_is_desktop_gl(ctx) &&
-         ctx->Extensions.ARB_texture_compression_bptc;
+      return _mesa_has_ARB_texture_compression_bptc(ctx);
    case MESA_FORMAT_LAYOUT_ASTC:
       return _mesa_has_KHR_texture_compression_astc_ldr(ctx);
    default:
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index c14f941..7910fe7 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -1387,7 +1387,7 @@ _mesa_target_can_be_compressed(const struct gl_context *ctx, GLenum target,
             return write_error(error, GL_INVALID_OPERATION);
          break;
       case MESA_FORMAT_LAYOUT_BPTC:
-         target_can_be_compresed = ctx->Extensions.ARB_texture_compression_bptc;
+         target_can_be_compresed = _mesa_has_ARB_texture_compression_bptc(ctx);
          break;
       case MESA_FORMAT_LAYOUT_ASTC:
          target_can_be_compresed =
-- 
2.6.1



More information about the mesa-dev mailing list