[Mesa-dev] [PATCH v2 13/18] mesa: Fix ASTC extension functionality leak into GLES 1

Nanley Chery nanleychery at gmail.com
Fri Oct 30 14:19:30 PDT 2015


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

Stop a leak of ASTC functionality into GLES 1 contexts.

v2. Handle ASTC driver capability check in texcompress.c

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

diff --git a/src/mesa/main/glformats.c b/src/mesa/main/glformats.c
index 5610de2..f37b5da 100644
--- a/src/mesa/main/glformats.c
+++ b/src/mesa/main/glformats.c
@@ -1331,7 +1331,7 @@ _mesa_is_compressed_format(const struct gl_context *ctx, GLenum format)
       return _mesa_is_desktop_gl(ctx) &&
          ctx->Extensions.ARB_texture_compression_bptc;
    case MESA_FORMAT_LAYOUT_ASTC:
-      return ctx->Extensions.KHR_texture_compression_astc_ldr;
+      return _mesa_has_KHR_texture_compression_astc_ldr(ctx);
    default:
       return GL_FALSE;
    }
@@ -2281,7 +2281,7 @@ _mesa_base_tex_format(const struct gl_context *ctx, GLint internalFormat)
             return base_compressed;
    }
 
-   if (ctx->Extensions.KHR_texture_compression_astc_ldr &&
+   if (_mesa_has_KHR_texture_compression_astc_ldr(ctx) &&
       _mesa_is_astc_format(internalFormat))
         return GL_RGBA;
 
diff --git a/src/mesa/main/texcompress.c b/src/mesa/main/texcompress.c
index 59bb0e1..2cc8a72 100644
--- a/src/mesa/main/texcompress.c
+++ b/src/mesa/main/texcompress.c
@@ -401,7 +401,7 @@ _mesa_get_compressed_formats(struct gl_context *ctx, GLint *formats)
     * query returns the set of supported specific compressed formats.
     */
    if (ctx->API == API_OPENGLES2 &&
-       ctx->Extensions.KHR_texture_compression_astc_ldr) {
+       _mesa_has_KHR_texture_compression_astc_ldr(ctx)) {
       if (formats) {
          formats[n++] = GL_COMPRESSED_RGBA_ASTC_4x4_KHR;
          formats[n++] = GL_COMPRESSED_RGBA_ASTC_5x4_KHR;
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index d9453e3..c14f941 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -1374,7 +1374,7 @@ _mesa_target_can_be_compressed(const struct gl_context *ctx, GLenum target,
        * TEXTURE_CUBE_MAP_ARRAY and the format is not ASTC.
        */
       if (target_can_be_compresed &&
-          ctx->Extensions.KHR_texture_compression_astc_ldr &&
+          _mesa_has_KHR_texture_compression_astc_ldr(ctx) &&
           layout != MESA_FORMAT_LAYOUT_ASTC)
          return write_error(error, GL_INVALID_OPERATION);
 
@@ -1391,7 +1391,7 @@ _mesa_target_can_be_compressed(const struct gl_context *ctx, GLenum target,
          break;
       case MESA_FORMAT_LAYOUT_ASTC:
          target_can_be_compresed =
-                             ctx->Extensions.KHR_texture_compression_astc_hdr;
+                             _mesa_has_KHR_texture_compression_astc_hdr(ctx);
 
          /* Throw an INVALID_OPERATION error if the target is TEXTURE_3D and
           * and the hdr extension is not supported.
@@ -1405,7 +1405,7 @@ _mesa_target_can_be_compressed(const struct gl_context *ctx, GLenum target,
           * the format is not ASTC.
           * See comment in switch case GL_TEXTURE_CUBE_MAP_ARRAY for more info.
           */
-         if (ctx->Extensions.KHR_texture_compression_astc_ldr)
+         if (_mesa_has_KHR_texture_compression_astc_ldr(ctx))
             return write_error(error, GL_INVALID_OPERATION);
          break;
       }
-- 
2.6.2



More information about the mesa-dev mailing list