mesa: Drop Mesa_DXTn from gl_context
authorMatt Turner <mattst88@gmail.com>
Thu, 28 Sep 2017 04:17:45 +0000 (21:17 -0700)
committerMatt Turner <mattst88@gmail.com>
Tue, 3 Oct 2017 02:41:22 +0000 (19:41 -0700)
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
15 files changed:
src/mesa/drivers/dri/i915/intel_extensions.c
src/mesa/drivers/dri/i965/intel_extensions.c
src/mesa/drivers/dri/nouveau/nv10_context.c
src/mesa/drivers/dri/nouveau/nv20_context.c
src/mesa/drivers/dri/r200/r200_context.c
src/mesa/drivers/dri/radeon/radeon_context.c
src/mesa/main/context.c
src/mesa/main/extensions.c
src/mesa/main/mtypes.h
src/mesa/main/texcompress_s3tc.c
src/mesa/main/texcompress_s3tc.h
src/mesa/main/texformat.c
src/mesa/main/teximage.c
src/mesa/state_tracker/st_context.c
src/mesa/state_tracker/st_format.c

index 4f2c6fa34e34b6b02890c0deb6aa83c800c18e4e..c85bd787fe73467f310497706fa7f9dacb727cd2 100644 (file)
@@ -100,9 +100,6 @@ intelInitExtensions(struct gl_context *ctx)
          ctx->Extensions.ARB_occlusion_query = true;
    }
 
-   if (intel->ctx.Mesa_DXTn
-       || driQueryOptionb(&intel->optionCache, "force_s3tc_enable"))
-      ctx->Extensions.EXT_texture_compression_s3tc = true;
-
+   ctx->Extensions.EXT_texture_compression_s3tc = true;
    ctx->Extensions.ANGLE_texture_compression_dxt = true;
 }
index 8aaea6fda23ce26d1b2f4e5a6bea0448755c517a..9487b4ae70f8b135a277eda0c4d4f8318a7e1fe4 100644 (file)
@@ -301,8 +301,6 @@ intelInitExtensions(struct gl_context *ctx)
    if (ctx->API != API_OPENGL_CORE)
       ctx->Extensions.ARB_color_buffer_float = true;
 
-   if (ctx->Mesa_DXTn || driQueryOptionb(&brw->optionCache, "force_s3tc_enable"))
-      ctx->Extensions.EXT_texture_compression_s3tc = true;
-
+   ctx->Extensions.EXT_texture_compression_s3tc = true;
    ctx->Extensions.ANGLE_texture_compression_dxt = true;
 }
index 7a86ba2358d698b4fb225d2a5bbd857bc2ab94f0..be2178fb79e89ba0406945c177dcaac6a55025a7 100644 (file)
@@ -451,10 +451,8 @@ nv10_context_create(struct nouveau_screen *screen, gl_api api,
        ctx->Extensions.EXT_texture_env_dot3 = true;
        ctx->Extensions.NV_fog_distance = true;
        ctx->Extensions.NV_texture_rectangle = true;
-       if (ctx->Mesa_DXTn) {
-               ctx->Extensions.EXT_texture_compression_s3tc = true;
-               ctx->Extensions.ANGLE_texture_compression_dxt = true;
-       }
+       ctx->Extensions.EXT_texture_compression_s3tc = true;
+       ctx->Extensions.ANGLE_texture_compression_dxt = true;
 
        /* GL constants. */
        ctx->Const.MaxTextureLevels = 12;
index ec638c036b18abc818e0146017f66f0f5067f7bd..0ab2db0b08609faf062f29b1a7c54aa6c8540365 100644 (file)
@@ -462,10 +462,8 @@ nv20_context_create(struct nouveau_screen *screen, gl_api api,
        ctx->Extensions.EXT_texture_env_dot3 = true;
        ctx->Extensions.NV_fog_distance = true;
        ctx->Extensions.NV_texture_rectangle = true;
-       if (ctx->Mesa_DXTn) {
-               ctx->Extensions.EXT_texture_compression_s3tc = true;
-               ctx->Extensions.ANGLE_texture_compression_dxt = true;
-       }
+       ctx->Extensions.EXT_texture_compression_s3tc = true;
+       ctx->Extensions.ANGLE_texture_compression_dxt = true;
 
        /* GL constants. */
        ctx->Const.MaxTextureCoordUnits = NV20_TEXTURE_UNITS;
index 0a27985de72541cd5071786a3c4e2b04d9acc6a7..b6354dccbb92bb06e73b15a772157f90f40a96d9 100644 (file)
@@ -363,14 +363,8 @@ GLboolean r200CreateContext( gl_api api,
        others get the bit ordering right but don't actually do YUV-RGB conversion */
       ctx->Extensions.MESA_ycbcr_texture = true;
    }
-   if (rmesa->radeon.glCtx.Mesa_DXTn) {
-      ctx->Extensions.EXT_texture_compression_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.EXT_texture_compression_s3tc = true;
+   ctx->Extensions.ANGLE_texture_compression_dxt = true;
 
 #if 0
    r200InitDriverFuncs( ctx );
index 28a79860d721aaf7ddcb6b18f965a3acb1aa71ff..c1ee8d8a76792ee823d2a44f71e07cb71ec61672 100644 (file)
@@ -311,14 +311,8 @@ r100CreateContext( gl_api api,
    ctx->Extensions.NV_texture_rectangle = true;
    ctx->Extensions.OES_EGL_image = true;
 
-   if (rmesa->radeon.glCtx.Mesa_DXTn) {
-      ctx->Extensions.EXT_texture_compression_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.EXT_texture_compression_s3tc = true;
+   ctx->Extensions.ANGLE_texture_compression_dxt = true;
 
    /* XXX these should really go right after _mesa_init_driver_functions() */
    radeon_fbo_init(&rmesa->radeon);
index 55a65ac2abe06bc99ef8ddb8d34f6d1d5b2df5c1..676103d477818a6b07c33fb822f609af6e753c77 100644 (file)
@@ -866,8 +866,6 @@ init_attrib_groups(struct gl_context *ctx)
    if (!_mesa_init_texture( ctx ))
       return GL_FALSE;
 
-   _mesa_init_texture_s3tc( ctx );
-
    /* Miscellaneous */
    ctx->NewState = _NEW_ALL;
    ctx->NewDriverState = ~0;
index 5a5fdd247f3e6e1a3e2410993e2c2a829ac0fc0a..f185aa5aab56eba0309d78f256d8009b42a15ad8 100644 (file)
@@ -177,10 +177,8 @@ _mesa_enable_sw_extensions(struct gl_context *ctx)
    ctx->Extensions.EXT_gpu_program_parameters = GL_TRUE;
    ctx->Extensions.OES_standard_derivatives = GL_TRUE;
    ctx->Extensions.TDFX_texture_compression_FXT1 = GL_TRUE;
-   if (ctx->Mesa_DXTn) {
-      ctx->Extensions.ANGLE_texture_compression_dxt = GL_TRUE;
-      ctx->Extensions.EXT_texture_compression_s3tc = GL_TRUE;
-   }
+   ctx->Extensions.ANGLE_texture_compression_dxt = GL_TRUE;
+   ctx->Extensions.EXT_texture_compression_s3tc = GL_TRUE;
 }
 
 /**
index db9ea760e01e3b1279b847445499baf31edbd85c..abda1a36e4605a36d8ba05fcd999410303788398 100644 (file)
@@ -4974,9 +4974,6 @@ struct gl_context
     */
    GLboolean HasConfig;
 
-   /** software compression/decompression supported or not */
-   GLboolean Mesa_DXTn;
-
    GLboolean TextureFormatSupported[MESA_FORMAT_COUNT];
 
    GLboolean RasterDiscard;  /**< GL_RASTERIZER_DISCARD */
index 14067f0e991b100b303665629be6c17ef546a0a4..a3bb340b4eeeda9151ad8a702df6c63dc1baf8f0 100644 (file)
 #include "util/format_srgb.h"
 
 
-void
-_mesa_init_texture_s3tc( struct gl_context *ctx )
-{
-   /* called during context initialization */
-   ctx->Mesa_DXTn = GL_TRUE;
-}
-
 /**
  * Store user's image in rgb_dxt1 format.
  */
index 438b71fe33230c7a6b6c8d72147a7f48cd9eaac2..0dbb5fc53713fba8a5cab6e177b1ccacb9e29501 100644 (file)
@@ -44,9 +44,6 @@ extern GLboolean
 _mesa_texstore_rgba_dxt5(TEXSTORE_PARAMS);
 
 
-extern void
-_mesa_init_texture_s3tc(struct gl_context *ctx);
-
 extern compressed_fetch_func
 _mesa_get_dxt_fetch_func(mesa_format format);
 
index baa3988f0a08ec473c96a95cc55c25c7174e5548..3f8e7a49a2782df47e3d37aa8630206848d598e1 100644 (file)
@@ -249,9 +249,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->Mesa_DXTn)
-            RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_DXT1);
-         RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_FXT1);
+         RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_DXT1);
       }
       RETURN_IF_SUPPORTED(MESA_FORMAT_BGR_UNORM8);
       RETURN_IF_SUPPORTED(MESA_FORMAT_B8G8R8X8_UNORM);
@@ -260,9 +258,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->Mesa_DXTn)
-            RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_DXT3); /* Not rgba_dxt1, see spec */
-         RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FXT1);
+         RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_DXT3); /* Not rgba_dxt1, see spec */
       }
       RETURN_IF_SUPPORTED(MESA_FORMAT_A8B8G8R8_UNORM);
       RETURN_IF_SUPPORTED(MESA_FORMAT_B8G8R8A8_UNORM);
@@ -502,15 +498,13 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target,
       RETURN_IF_SUPPORTED(MESA_FORMAT_A8R8G8B8_SRGB);
       break;
    case GL_COMPRESSED_SRGB_EXT:
-      if (ctx->Mesa_DXTn)
-         RETURN_IF_SUPPORTED(MESA_FORMAT_SRGB_DXT1);
+      RETURN_IF_SUPPORTED(MESA_FORMAT_SRGB_DXT1);
       RETURN_IF_SUPPORTED(MESA_FORMAT_BGR_SRGB8);
       RETURN_IF_SUPPORTED(MESA_FORMAT_B8G8R8A8_SRGB);
       RETURN_IF_SUPPORTED(MESA_FORMAT_A8R8G8B8_SRGB);
       break;
    case GL_COMPRESSED_SRGB_ALPHA_EXT:
-      if (ctx->Mesa_DXTn)
-         RETURN_IF_SUPPORTED(MESA_FORMAT_SRGBA_DXT3); /* Not srgba_dxt1, see spec */
+      RETURN_IF_SUPPORTED(MESA_FORMAT_SRGBA_DXT3); /* Not srgba_dxt1, see spec */
       RETURN_IF_SUPPORTED(MESA_FORMAT_A8B8G8R8_SRGB);
       RETURN_IF_SUPPORTED(MESA_FORMAT_B8G8R8A8_SRGB);
       RETURN_IF_SUPPORTED(MESA_FORMAT_A8R8G8B8_SRGB);
index d06420519095a63c503e00124123f0080682319e..0a3025a2e6bc6f1dbe08d210a9cda2806608a182 100644 (file)
@@ -2769,38 +2769,6 @@ _mesa_choose_texture_format(struct gl_context *ctx,
       }
    }
 
-   /* If the application requested compression to an S3TC format but we don't
-    * have the DXTn library, force a generic compressed format instead.
-    */
-   if (internalFormat != format && format != GL_NONE) {
-      const GLenum before = internalFormat;
-
-      switch (internalFormat) {
-      case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
-         if (!ctx->Mesa_DXTn)
-            internalFormat = GL_COMPRESSED_RGB;
-         break;
-      case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
-      case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
-      case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
-         if (!ctx->Mesa_DXTn)
-            internalFormat = GL_COMPRESSED_RGBA;
-         break;
-      default:
-         break;
-      }
-
-      if (before != internalFormat) {
-         _mesa_warning(ctx,
-                       "DXT compression requested (%s), "
-                       "but libtxc_dxtn library not installed.  Using %s "
-                       "instead.",
-                       _mesa_enum_to_string(before),
-                       _mesa_enum_to_string(internalFormat));
-      }
-   }
-
-   /* choose format from scratch */
    f = ctx->Driver.ChooseTextureFormat(ctx, target, internalFormat,
                                        format, type);
    assert(f != MESA_FORMAT_NONE);
index ef2e73e7415e5f80d40fd5b3a9e4f338b43bae7a..2422640d8493a421fe3536d4a4d2edb0275fc42c 100644 (file)
@@ -406,7 +406,7 @@ st_create_context_priv( struct gl_context *ctx, struct pipe_context *pipe,
    /* GL limits and extensions */
    st_init_limits(pipe->screen, &ctx->Const, &ctx->Extensions);
    st_init_extensions(pipe->screen, &ctx->Const,
-                      &ctx->Extensions, &st->options, ctx->Mesa_DXTn);
+                      &ctx->Extensions, &st->options, GL_TRUE);
 
    if (st_have_perfmon(st)) {
       ctx->Extensions.AMD_performance_monitor = GL_TRUE;
index 84b744e3df59777e8ee25ac2d499bc434789d7e4..5e38fe5689030b2aaf6af7b7d2154dca73fc321e 100644 (file)
@@ -2280,13 +2280,13 @@ st_ChooseTextureFormat(struct gl_context *ctx, GLenum target,
    }
 
    pFormat = st_choose_format(st, internalFormat, format, type,
-                              pTarget, 0, bindings, ctx->Mesa_DXTn);
+                              pTarget, 0, bindings, GL_TRUE);
 
    if (pFormat == PIPE_FORMAT_NONE && !is_renderbuffer) {
       /* try choosing format again, this time without render target bindings */
       pFormat = st_choose_format(st, internalFormat, format, type,
                                  pTarget, 0, PIPE_BIND_SAMPLER_VIEW,
-                                 ctx->Mesa_DXTn);
+                                 GL_TRUE);
    }
 
    if (pFormat == PIPE_FORMAT_NONE) {