st/mesa: respect force_s3tc_enable environment variable
authorBryan Cain <bryancain3@gmail.com>
Mon, 25 Jul 2011 18:30:17 +0000 (13:30 -0500)
committerBryan Cain <bryancain3@gmail.com>
Tue, 26 Jul 2011 17:54:40 +0000 (12:54 -0500)
NOTE: This is a candidate for the 7.10 and 7.11 branches.

src/mesa/state_tracker/st_extensions.c

index 99b231d9706a03622e7e303050ed07af6611d435..b5f6d356eb067863621ec2d74ba15f36ff05c8a4 100644 (file)
@@ -208,6 +208,15 @@ void st_init_limits(struct st_context *st)
 }
 
 
+static GLboolean st_get_s3tc_override(void)
+{
+   const char *override = _mesa_getenv("force_s3tc_enable");
+   if (override && !strcmp(override, "true"))
+      return GL_TRUE;
+   return GL_FALSE;
+}
+
+
 /**
  * Use pipe_screen::get_param() to query PIPE_CAP_ values to determine
  * which GL extensions are supported.
@@ -426,7 +435,7 @@ void st_init_extensions(struct st_context *st)
    if (screen->is_format_supported(screen, PIPE_FORMAT_DXT5_RGBA,
                                    PIPE_TEXTURE_2D, 0,
                                    PIPE_BIND_SAMPLER_VIEW) &&
-       ctx->Mesa_DXTn) {
+       (ctx->Mesa_DXTn || st_get_s3tc_override())) {
       ctx->Extensions.EXT_texture_compression_s3tc = GL_TRUE;
       ctx->Extensions.S3_s3tc = GL_TRUE;
    }