[Mesa-dev] [PATCH 2/2] mesa: use the EXT_texture_compression_s3tc enable flag for all S3TC extensions

Marek Olšák maraeo at gmail.com
Sun Oct 28 08:09:32 PDT 2012


---
 src/mesa/drivers/dri/intel/intel_extensions.c |    2 --
 src/mesa/drivers/dri/nouveau/nv10_context.c   |    1 -
 src/mesa/drivers/dri/nouveau/nv20_context.c   |    1 -
 src/mesa/drivers/dri/r200/r200_context.c      |    1 -
 src/mesa/drivers/dri/radeon/radeon_context.c  |    1 -
 src/mesa/drivers/x11/xm_api.c                 |    1 -
 src/mesa/main/extensions.c                    |    8 +++-----
 src/mesa/main/glformats.c                     |   11 ++++++-----
 src/mesa/main/mtypes.h                        |    2 --
 src/mesa/main/texcompress.c                   |   10 ++--------
 src/mesa/main/texformat.c                     |   21 +++++++--------------
 src/mesa/main/teximage.c                      |    6 ++++--
 src/mesa/state_tracker/st_extensions.c        |    4 +---
 13 files changed, 23 insertions(+), 46 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_extensions.c b/src/mesa/drivers/dri/intel/intel_extensions.c
index 702e40f..8489d46 100755
--- a/src/mesa/drivers/dri/intel/intel_extensions.c
+++ b/src/mesa/drivers/dri/intel/intel_extensions.c
@@ -181,9 +181,7 @@ intelInitExtensions(struct gl_context *ctx)
    }
 
    if (intel->ctx.Mesa_DXTn) {
-      ctx->Extensions.ANGLE_texture_compression_dxt = true;
       ctx->Extensions.EXT_texture_compression_s3tc = true;
-      ctx->Extensions.S3_s3tc = true;
    }
    else if (driQueryOptionb(&intel->optionCache, "force_s3tc_enable")) {
       ctx->Extensions.EXT_texture_compression_s3tc = true;
diff --git a/src/mesa/drivers/dri/nouveau/nv10_context.c b/src/mesa/drivers/dri/nouveau/nv10_context.c
index 97fc84d..21a4080 100644
--- a/src/mesa/drivers/dri/nouveau/nv10_context.c
+++ b/src/mesa/drivers/dri/nouveau/nv10_context.c
@@ -451,7 +451,6 @@ nv10_context_create(struct nouveau_screen *screen, const struct gl_config *visua
 	ctx->Extensions.NV_texture_rectangle = true;
 	if (ctx->Mesa_DXTn) {
 		ctx->Extensions.EXT_texture_compression_s3tc = true;
-		ctx->Extensions.S3_s3tc = true;
 	}
 
 	/* GL constants. */
diff --git a/src/mesa/drivers/dri/nouveau/nv20_context.c b/src/mesa/drivers/dri/nouveau/nv20_context.c
index 52013fd..d0e9f9c 100644
--- a/src/mesa/drivers/dri/nouveau/nv20_context.c
+++ b/src/mesa/drivers/dri/nouveau/nv20_context.c
@@ -462,7 +462,6 @@ nv20_context_create(struct nouveau_screen *screen, const struct gl_config *visua
 	ctx->Extensions.NV_texture_rectangle = true;
 	if (ctx->Mesa_DXTn) {
 		ctx->Extensions.EXT_texture_compression_s3tc = true;
-		ctx->Extensions.S3_s3tc = true;
 	}
 
 	/* GL constants. */
diff --git a/src/mesa/drivers/dri/r200/r200_context.c b/src/mesa/drivers/dri/r200/r200_context.c
index 677dc8d..32164f9 100644
--- a/src/mesa/drivers/dri/r200/r200_context.c
+++ b/src/mesa/drivers/dri/r200/r200_context.c
@@ -408,7 +408,6 @@ GLboolean r200CreateContext( gl_api api,
    }
    if (rmesa->radeon.glCtx.Mesa_DXTn) {
       ctx->Extensions.EXT_texture_compression_s3tc = true;
-      ctx->Extensions.S3_s3tc = true;
    }
    else if (driQueryOptionb (&rmesa->radeon.optionCache, "force_s3tc_enable")) {
       ctx->Extensions.EXT_texture_compression_s3tc = true;
diff --git a/src/mesa/drivers/dri/radeon/radeon_context.c b/src/mesa/drivers/dri/radeon/radeon_context.c
index 962f08a..90a8131 100644
--- a/src/mesa/drivers/dri/radeon/radeon_context.c
+++ b/src/mesa/drivers/dri/radeon/radeon_context.c
@@ -359,7 +359,6 @@ r100CreateContext( gl_api api,
 
    if (rmesa->radeon.glCtx.Mesa_DXTn) {
       ctx->Extensions.EXT_texture_compression_s3tc = true;
-      ctx->Extensions.S3_s3tc = true;
    }
    else if (driQueryOptionb (&rmesa->radeon.optionCache, "force_s3tc_enable")) {
       ctx->Extensions.EXT_texture_compression_s3tc = true;
diff --git a/src/mesa/drivers/x11/xm_api.c b/src/mesa/drivers/x11/xm_api.c
index 43a97f9..dc37e35 100644
--- a/src/mesa/drivers/x11/xm_api.c
+++ b/src/mesa/drivers/x11/xm_api.c
@@ -923,7 +923,6 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list )
    _mesa_enable_2_1_extensions(mesaCtx);
     if (mesaCtx->Mesa_DXTn) {
        _mesa_enable_extension(mesaCtx, "GL_EXT_texture_compression_s3tc");
-       _mesa_enable_extension(mesaCtx, "GL_S3_s3tc");
     }
     _mesa_enable_extension(mesaCtx, "GL_3DFX_texture_compression_FXT1");
 #if ENABLE_EXT_timer_query
diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
index 56d5f90..7e2d78a 100644
--- a/src/mesa/main/extensions.c
+++ b/src/mesa/main/extensions.c
@@ -196,8 +196,8 @@ static const struct extension extension_table[] = {
    { "GL_EXT_texture3D",                           o(dummy_true),                              GLL,            1996 },
    { "GL_EXT_texture_array",                       o(EXT_texture_array),                       GL,             2006 },
    { "GL_EXT_texture_compression_dxt1",            o(EXT_texture_compression_s3tc),            GL | ES1 | ES2, 2004 },
-   { "GL_ANGLE_texture_compression_dxt3",          o(ANGLE_texture_compression_dxt),           ES2,            2011 },
-   { "GL_ANGLE_texture_compression_dxt5",          o(ANGLE_texture_compression_dxt),           ES2,            2011 },
+   { "GL_ANGLE_texture_compression_dxt3",          o(EXT_texture_compression_s3tc),                       ES2, 2011 },
+   { "GL_ANGLE_texture_compression_dxt5",          o(EXT_texture_compression_s3tc),                       ES2, 2011 },
    { "GL_EXT_texture_compression_latc",            o(EXT_texture_compression_latc),            GL,             2006 },
    { "GL_EXT_texture_compression_rgtc",            o(ARB_texture_compression_rgtc),            GL,             2004 },
    { "GL_EXT_texture_compression_s3tc",            o(EXT_texture_compression_s3tc),            GL,             2000 },
@@ -312,7 +312,7 @@ static const struct extension extension_table[] = {
    { "GL_NV_texture_barrier",                      o(NV_texture_barrier),                      GL,             2009 },
    { "GL_NV_texture_env_combine4",                 o(NV_texture_env_combine4),                 GLL,            1999 },
    { "GL_NV_texture_rectangle",                    o(NV_texture_rectangle),                    GLL,            2000 },
-   { "GL_S3_s3tc",                                 o(S3_s3tc),                                 GL,             1999 },
+   { "GL_S3_s3tc",                                 o(EXT_texture_compression_s3tc),            GL,             1999 },
    { "GL_SGIS_generate_mipmap",                    o(dummy_true),                              GLL,            1997 },
    { "GL_SGIS_texture_border_clamp",               o(ARB_texture_border_clamp),                GLL,            1997 },
    { "GL_SGIS_texture_edge_clamp",                 o(dummy_true),                              GLL,            1997 },
@@ -441,9 +441,7 @@ _mesa_enable_sw_extensions(struct gl_context *ctx)
    ctx->Extensions.OES_standard_derivatives = GL_TRUE;
    _mesa_enable_extension(ctx, "GL_3DFX_texture_compression_FXT1");
    if (ctx->Mesa_DXTn) {
-      ctx->Extensions.ANGLE_texture_compression_dxt = GL_TRUE;
       _mesa_enable_extension(ctx, "GL_EXT_texture_compression_s3tc");
-      _mesa_enable_extension(ctx, "GL_S3_s3tc");
    }
 }
 
diff --git a/src/mesa/main/glformats.c b/src/mesa/main/glformats.c
index ba79f19..bdb6e66 100644
--- a/src/mesa/main/glformats.c
+++ b/src/mesa/main/glformats.c
@@ -791,15 +791,16 @@ _mesa_is_compressed_format(struct gl_context *ctx, GLenum format)
       return ctx->Extensions.EXT_texture_compression_s3tc;
    case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
    case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
-      return (_mesa_is_desktop_gl(ctx) &&
-	      ctx->Extensions.EXT_texture_compression_s3tc) ||
-	     (ctx->API == API_OPENGLES2 &&
-	      ctx->Extensions.ANGLE_texture_compression_dxt);
+      /* ANGLE_texture_compression_dxt to aliased to the EXT extension. */
+      return ctx->Extensions.EXT_texture_compression_s3tc &&
+             (_mesa_is_desktop_gl(ctx) || ctx->API == API_OPENGLES2);
    case GL_RGB_S3TC:
    case GL_RGB4_S3TC:
    case GL_RGBA_S3TC:
    case GL_RGBA4_S3TC:
-      return _mesa_is_desktop_gl(ctx) && ctx->Extensions.S3_s3tc;
+      /* S3_s3tc is aliased to the EXT extension. */
+      return _mesa_is_desktop_gl(ctx) &&
+            ctx->Extensions.EXT_texture_compression_s3tc;
    case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT:
    case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:
    case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index fb47a72..a75aaf8 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -2931,7 +2931,6 @@ struct gl_extensions
    GLboolean dummy;  /* don't remove this! */
    GLboolean dummy_true;  /* Set true by _mesa_init_extensions(). */
    GLboolean dummy_false; /* Set false by _mesa_init_extensions(). */
-   GLboolean ANGLE_texture_compression_dxt;
    GLboolean ARB_ES2_compatibility;
    GLboolean ARB_base_instance;
    GLboolean ARB_blend_func_extended;
@@ -3048,7 +3047,6 @@ struct gl_extensions
    GLboolean NV_texture_env_combine4;
    GLboolean NV_texture_rectangle;
    GLboolean TDFX_texture_compression_FXT1;
-   GLboolean S3_s3tc;
    GLboolean OES_EGL_image;
    GLboolean OES_draw_texture;
    GLboolean OES_EGL_image_external;
diff --git a/src/mesa/main/texcompress.c b/src/mesa/main/texcompress.c
index 957cc6d..75bca24 100644
--- a/src/mesa/main/texcompress.c
+++ b/src/mesa/main/texcompress.c
@@ -245,24 +245,18 @@ _mesa_get_compressed_formats(struct gl_context *ctx, GLint *formats)
    }
 
    if (ctx->Extensions.EXT_texture_compression_s3tc) {
+      /* S3_s3tc is aliased to the EXT extension. */
       if (formats) {
          formats[n++] = GL_COMPRESSED_RGB_S3TC_DXT1_EXT;
          formats[n++] = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT;
          formats[n++] = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT;
-      }
-      else {
-         n += 3;
-      }
-   }
-   if (ctx->Extensions.S3_s3tc) {
-      if (formats) {
          formats[n++] = GL_RGB_S3TC;
          formats[n++] = GL_RGB4_S3TC;
          formats[n++] = GL_RGBA_S3TC;
          formats[n++] = GL_RGBA4_S3TC;
       }
       else {
-         n += 4;
+         n += 7;
       }
    }
 
diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c
index f0bc7fd..00ab47d 100644
--- a/src/mesa/main/texformat.c
+++ b/src/mesa/main/texformat.c
@@ -244,8 +244,7 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target,
           * 1D ARRAY textures in S3TC format.
           */
          if (target != GL_TEXTURE_1D && target != GL_TEXTURE_1D_ARRAY) {
-            if (ctx->Extensions.EXT_texture_compression_s3tc ||
-                ctx->Extensions.S3_s3tc)
+            if (ctx->Extensions.EXT_texture_compression_s3tc)
                RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_DXT1);
             if (ctx->Extensions.TDFX_texture_compression_FXT1)
                RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_FXT1);
@@ -257,8 +256,7 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target,
       case GL_COMPRESSED_RGBA_ARB:
          /* We don't use texture compression for 1D and 1D array textures. */
          if (target != GL_TEXTURE_1D && target != GL_TEXTURE_1D_ARRAY) {
-            if (ctx->Extensions.EXT_texture_compression_s3tc ||
-                ctx->Extensions.S3_s3tc)
+            if (ctx->Extensions.EXT_texture_compression_s3tc)
                RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_DXT3); /* Not rgba_dxt1, see spec */
             if (ctx->Extensions.TDFX_texture_compression_FXT1)
                RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FXT1);
@@ -302,9 +300,7 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target,
       }
    }
 
-   if (ctx->Extensions.EXT_texture_compression_s3tc ||
-       (ctx->API == API_OPENGLES2 &&
-	ctx->Extensions.ANGLE_texture_compression_dxt)) {
+   if (ctx->Extensions.EXT_texture_compression_s3tc) {
       switch (internalFormat) {
          case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
 	    RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_DXT1);
@@ -323,7 +319,8 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target,
       }
    }
 
-   if (ctx->Extensions.S3_s3tc) {
+   /* S3_s3tc is aliased to the EXT extension. */
+   if (ctx->Extensions.EXT_texture_compression_s3tc) {
       switch (internalFormat) {
          case GL_RGB_S3TC:
          case GL_RGB4_S3TC:
@@ -606,16 +603,12 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target,
 	    RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8);
             break;
          case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:
-            if (ctx->Extensions.EXT_texture_compression_s3tc ||
-		(ctx->API == API_OPENGLES2 &&
-		 ctx->Extensions.ANGLE_texture_compression_dxt))
+            if (ctx->Extensions.EXT_texture_compression_s3tc)
 	       RETURN_IF_SUPPORTED(MESA_FORMAT_SRGBA_DXT3);
 	    RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8);
             break;
          case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:
-            if (ctx->Extensions.EXT_texture_compression_s3tc ||
-		(ctx->API == API_OPENGLES2 &&
-		 ctx->Extensions.ANGLE_texture_compression_dxt))
+            if (ctx->Extensions.EXT_texture_compression_s3tc)
 	       RETURN_IF_SUPPORTED(MESA_FORMAT_SRGBA_DXT5);
 	    RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8);
             break;
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index b889317..f0703b3 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -204,8 +204,9 @@ _mesa_base_tex_format( struct gl_context *ctx, GLint internalFormat )
    }
 
    /* GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE && GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE */
+   /* ANGLE_texture_compression_dxt is aliased to the EXT extension. */
    if (ctx->API == API_OPENGLES2 &&
-       ctx->Extensions.ANGLE_texture_compression_dxt) {
+       ctx->Extensions.EXT_texture_compression_s3tc) {
       switch (internalFormat) {
          case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
          case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
@@ -215,7 +216,8 @@ _mesa_base_tex_format( struct gl_context *ctx, GLint internalFormat )
       }
    }
 
-   if (ctx->Extensions.S3_s3tc) {
+   /* S3_s3tc is aliased to the EXT extension. */
+   if (ctx->Extensions.EXT_texture_compression_s3tc) {
       switch (internalFormat) {
          case GL_RGB_S3TC:
          case GL_RGB4_S3TC:
diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c
index 4d0c9c5..a0bf471 100644
--- a/src/mesa/state_tracker/st_extensions.c
+++ b/src/mesa/state_tracker/st_extensions.c
@@ -433,8 +433,7 @@ void st_init_extensions(struct st_context *st)
           PIPE_FORMAT_LATC2_UNORM,
           PIPE_FORMAT_LATC2_SNORM } },
 
-      { { o(EXT_texture_compression_s3tc),
-          o(S3_s3tc) },
+      { { o(EXT_texture_compression_s3tc) },
         { PIPE_FORMAT_DXT1_RGB,
           PIPE_FORMAT_DXT1_RGBA,
           PIPE_FORMAT_DXT3_RGBA,
@@ -581,7 +580,6 @@ void st_init_extensions(struct st_context *st)
 
    if (!ctx->Mesa_DXTn && !st_get_s3tc_override()) {
       ctx->Extensions.EXT_texture_compression_s3tc = GL_FALSE;
-      ctx->Extensions.S3_s3tc = GL_FALSE;
    }
 
    if (screen->get_shader_param(screen, PIPE_SHADER_GEOMETRY,
-- 
1.7.9.5



More information about the mesa-dev mailing list