[Mesa-dev] [PATCH 1/3] mesa: Use a one flag for the S3TC extensions that don't require on-line compression

Ian Romanick idr at freedesktop.org
Mon Jan 21 08:53:33 PST 2013


From: Ian Romanick <ian.d.romanick at intel.com>

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
 src/mesa/drivers/dri/intel/intel_extensions.c | 1 -
 src/mesa/drivers/dri/nouveau/nv10_context.c   | 2 +-
 src/mesa/drivers/dri/nouveau/nv20_context.c   | 2 +-
 src/mesa/drivers/dri/r200/r200_context.c      | 3 ++-
 src/mesa/drivers/dri/radeon/radeon_context.c  | 3 ++-
 src/mesa/drivers/x11/xm_api.c                 | 2 +-
 src/mesa/main/extensions.c                    | 4 ++--
 src/mesa/main/glformats.c                     | 3 ++-
 src/mesa/main/mtypes.h                        | 1 -
 src/mesa/main/texcompress.c                   | 4 +++-
 src/mesa/main/texformat.c                     | 7 ++++---
 src/mesa/main/teximage.c                      | 3 ++-
 src/mesa/state_tracker/st_extensions.c        | 4 ++--
 13 files changed, 22 insertions(+), 17 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_extensions.c b/src/mesa/drivers/dri/intel/intel_extensions.c
index 4e7b5da..40170e5 100755
--- a/src/mesa/drivers/dri/intel/intel_extensions.c
+++ b/src/mesa/drivers/dri/intel/intel_extensions.c
@@ -178,7 +178,6 @@ 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..7eda4e0 100644
--- a/src/mesa/drivers/dri/nouveau/nv10_context.c
+++ b/src/mesa/drivers/dri/nouveau/nv10_context.c
@@ -451,7 +451,7 @@ 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;
+		ctx->Extensions.ANGLE_texture_compression_dxt = 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..68e90d2 100644
--- a/src/mesa/drivers/dri/nouveau/nv20_context.c
+++ b/src/mesa/drivers/dri/nouveau/nv20_context.c
@@ -462,7 +462,7 @@ 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;
+		ctx->Extensions.ANGLE_texture_compression_dxt = true;
 	}
 
 	/* GL constants. */
diff --git a/src/mesa/drivers/dri/r200/r200_context.c b/src/mesa/drivers/dri/r200/r200_context.c
index cf35079..2729283 100644
--- a/src/mesa/drivers/dri/r200/r200_context.c
+++ b/src/mesa/drivers/dri/r200/r200_context.c
@@ -409,10 +409,11 @@ GLboolean r200CreateContext( gl_api api,
    }
    if (rmesa->radeon.glCtx.Mesa_DXTn) {
       ctx->Extensions.EXT_texture_compression_s3tc = true;
-      ctx->Extensions.S3_s3tc = true;
+      ctx->Extensions.ANGLE_texture_compression_dxt = true;
    }
    else if (driQueryOptionb (&rmesa->radeon.optionCache, "force_s3tc_enable")) {
       ctx->Extensions.EXT_texture_compression_s3tc = true;
+      ctx->Extensions.ANGLE_texture_compression_dxt = true;
    }
 
    ctx->Extensions.ARB_texture_cube_map = true;
diff --git a/src/mesa/drivers/dri/radeon/radeon_context.c b/src/mesa/drivers/dri/radeon/radeon_context.c
index 26490ea..d30d43e 100644
--- a/src/mesa/drivers/dri/radeon/radeon_context.c
+++ b/src/mesa/drivers/dri/radeon/radeon_context.c
@@ -361,10 +361,11 @@ r100CreateContext( gl_api api,
 
    if (rmesa->radeon.glCtx.Mesa_DXTn) {
       ctx->Extensions.EXT_texture_compression_s3tc = true;
-      ctx->Extensions.S3_s3tc = true;
+      ctx->Extensions.ANGLE_texture_compression_dxt = true;
    }
    else if (driQueryOptionb (&rmesa->radeon.optionCache, "force_s3tc_enable")) {
       ctx->Extensions.EXT_texture_compression_s3tc = true;
+      ctx->Extensions.ANGLE_texture_compression_dxt = true;
    }
 
    ctx->Extensions.NV_texture_rectangle = true;
diff --git a/src/mesa/drivers/x11/xm_api.c b/src/mesa/drivers/x11/xm_api.c
index 2ba65ff..7a53fd9 100644
--- a/src/mesa/drivers/x11/xm_api.c
+++ b/src/mesa/drivers/x11/xm_api.c
@@ -929,7 +929,7 @@ 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_ANGLE_texture_compression_dxt");
     }
     _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 fd25d31..375978e 100644
--- a/src/mesa/main/extensions.c
+++ b/src/mesa/main/extensions.c
@@ -201,7 +201,7 @@ static const struct extension extension_table[] = {
    { "GL_EXT_subtexture",                          o(dummy_true),                              GLL,            1995 },
    { "GL_EXT_texture3D",                           o(EXT_texture3D),                           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_EXT_texture_compression_dxt1",            o(ANGLE_texture_compression_dxt),           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_EXT_texture_compression_latc",            o(EXT_texture_compression_latc),            GL,             2006 },
@@ -321,7 +321,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(ANGLE_texture_compression_dxt),           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 },
diff --git a/src/mesa/main/glformats.c b/src/mesa/main/glformats.c
index e4f7841..fc8bc2e 100644
--- a/src/mesa/main/glformats.c
+++ b/src/mesa/main/glformats.c
@@ -878,7 +878,8 @@ _mesa_is_compressed_format(struct gl_context *ctx, GLenum format)
    case GL_RGB4_S3TC:
    case GL_RGBA_S3TC:
    case GL_RGBA4_S3TC:
-      return _mesa_is_desktop_gl(ctx) && ctx->Extensions.S3_s3tc;
+      return _mesa_is_desktop_gl(ctx) &&
+         ctx->Extensions.ANGLE_texture_compression_dxt;
    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 cba1e16..4ba0dce 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -3130,7 +3130,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_depth_texture_cube_map;
diff --git a/src/mesa/main/texcompress.c b/src/mesa/main/texcompress.c
index 077a967..734294e 100644
--- a/src/mesa/main/texcompress.c
+++ b/src/mesa/main/texcompress.c
@@ -37,6 +37,7 @@
 #include "formats.h"
 #include "mfeatures.h"
 #include "mtypes.h"
+#include "context.h"
 #include "texcompress.h"
 #include "texcompress_fxt1.h"
 #include "texcompress_rgtc.h"
@@ -264,7 +265,8 @@ _mesa_get_compressed_formats(struct gl_context *ctx, GLint *formats)
          n += 3;
       }
    }
-   if (ctx->Extensions.S3_s3tc) {
+   if (_mesa_is_desktop_gl(ctx)
+       && ctx->Extensions.ANGLE_texture_compression_dxt) {
       if (formats) {
          formats[n++] = GL_RGB_S3TC;
          formats[n++] = GL_RGB4_S3TC;
diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c
index 4fb4b70..b0ff6ec 100644
--- a/src/mesa/main/texformat.c
+++ b/src/mesa/main/texformat.c
@@ -251,7 +251,7 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target,
           */
          if (target != GL_TEXTURE_1D && target != GL_TEXTURE_1D_ARRAY) {
             if (ctx->Extensions.EXT_texture_compression_s3tc ||
-                ctx->Extensions.S3_s3tc)
+                ctx->Extensions.ANGLE_texture_compression_dxt)
                RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_DXT1);
             if (ctx->Extensions.TDFX_texture_compression_FXT1)
                RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_FXT1);
@@ -264,7 +264,7 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target,
          /* 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)
+                ctx->Extensions.ANGLE_texture_compression_dxt)
                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);
@@ -329,7 +329,8 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target,
       }
    }
 
-   if (ctx->Extensions.S3_s3tc) {
+   if (_mesa_is_desktop_gl(ctx)
+       && ctx->Extensions.ANGLE_texture_compression_dxt) {
       switch (internalFormat) {
          case GL_RGB_S3TC:
          case GL_RGB4_S3TC:
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index 7b84dd2..0ce22cf 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -215,7 +215,8 @@ _mesa_base_tex_format( struct gl_context *ctx, GLint internalFormat )
       }
    }
 
-   if (ctx->Extensions.S3_s3tc) {
+   if (_mesa_is_desktop_gl(ctx)
+       && ctx->Extensions.ANGLE_texture_compression_dxt) {
       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 17fe16e..18d8981 100644
--- a/src/mesa/state_tracker/st_extensions.c
+++ b/src/mesa/state_tracker/st_extensions.c
@@ -454,7 +454,7 @@ void st_init_extensions(struct st_context *st)
           PIPE_FORMAT_LATC2_SNORM } },
 
       { { o(EXT_texture_compression_s3tc),
-          o(S3_s3tc) },
+          o(ANGLE_texture_compression_dxt) },
         { PIPE_FORMAT_DXT1_RGB,
           PIPE_FORMAT_DXT1_RGBA,
           PIPE_FORMAT_DXT3_RGBA,
@@ -611,7 +611,7 @@ 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;
+      ctx->Extensions.ANGLE_texture_compression_dxt = GL_FALSE;
    }
 
    if (screen->get_shader_param(screen, PIPE_SHADER_GEOMETRY,
-- 
1.7.11.7



More information about the mesa-dev mailing list