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

Kenneth Graunke kenneth at whitecape.org
Sun Oct 28 12:51:07 PDT 2012


On 10/28/2012 08:09 AM, Marek Olšák wrote:
> ---
>   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. */

"is aliased"

This makes sense to me.  The original reason for splitting out the ANGLE 
vs. EXT bits was that the ANGLE extension only requires decompression, 
while the other two require both compression and decompression.  So that 
one could be advertised even without libtxc_dxtn.

Of course, now that we've decided to simply lie and fall back to 
GL_COMPRESSED_RGB[A] when the user asks for online compression and we 
don't have libtxc_dxtn, this isn't a problem.  So we can simplify.

For both patches:
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>


More information about the mesa-dev mailing list