summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2013-07-30 22:29:18 +0200
committerMarek Olšák <[email protected]>2013-07-30 23:31:24 +0200
commit83dbe61ea4308638f1c041d2f550f0f719e36967 (patch)
tree80708f40e9455509a9c24cd6f01e33ed14372ec7 /src/gallium/state_trackers
parentf27f3a4b15449e9ba3c0ee4e01b9db753e48e55f (diff)
st/dri: implement the driconf option force_s3tc_enable properly
Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers')
-rw-r--r--src/gallium/state_trackers/dri/common/dri_context.c2
-rw-r--r--src/gallium/state_trackers/dri/common/dri_screen.c19
-rw-r--r--src/gallium/state_trackers/osmesa/osmesa.c1
3 files changed, 20 insertions, 2 deletions
diff --git a/src/gallium/state_trackers/dri/common/dri_context.c b/src/gallium/state_trackers/dri/common/dri_context.c
index 5794e487158..ab80fc75bd4 100644
--- a/src/gallium/state_trackers/dri/common/dri_context.c
+++ b/src/gallium/state_trackers/dri/common/dri_context.c
@@ -58,6 +58,8 @@ static void dri_fill_st_options(struct st_config_options *options,
driQueryOptionb(optionCache, "disable_glsl_line_continuations");
options->disable_blend_func_extended =
driQueryOptionb(optionCache, "disable_blend_func_extended");
+ options->force_s3tc_enable =
+ driQueryOptionb(optionCache, "force_s3tc_enable");
}
GLboolean
diff --git a/src/gallium/state_trackers/dri/common/dri_screen.c b/src/gallium/state_trackers/dri/common/dri_screen.c
index c8aed63f1d3..ca17742eb5b 100644
--- a/src/gallium/state_trackers/dri/common/dri_screen.c
+++ b/src/gallium/state_trackers/dri/common/dri_screen.c
@@ -41,6 +41,7 @@
#include "state_tracker/drm_driver.h"
#include "util/u_debug.h"
+#include "util/u_format_s3tc.h"
#define MSAA_VISUAL_MAX_SAMPLES 32
@@ -54,7 +55,7 @@ PUBLIC const char __driConfigOptions[] =
DRI_CONF_SECTION_END
DRI_CONF_SECTION_QUALITY
-/* DRI_CONF_FORCE_S3TC_ENABLE("false") */
+ DRI_CONF_FORCE_S3TC_ENABLE("false")
DRI_CONF_PP_CELSHADE(0)
DRI_CONF_PP_NORED(0)
DRI_CONF_PP_NOGREEN(0)
@@ -76,7 +77,7 @@ PUBLIC const char __driConfigOptions[] =
#define false 0
-static const uint __driNConfigOptions = 12;
+static const uint __driNConfigOptions = 13;
static const __DRIconfig **
dri_fill_in_modes(struct dri_screen *screen)
@@ -416,6 +417,20 @@ dri_init_screen_helper(struct dri_screen *screen,
screen->sPriv->myNum,
driver_descriptor.name);
+ /* Handle force_s3tc_enable. */
+ if (!util_format_s3tc_enabled &&
+ driQueryOptionb(&screen->optionCache, "force_s3tc_enable")) {
+ /* Ensure libtxc_dxtn has been loaded if available.
+ * Forcing S3TC on before calling this would prevent loading
+ * the library.
+ * This is just a precaution, the driver should have called it
+ * already.
+ */
+ util_format_s3tc_init();
+
+ util_format_s3tc_enabled = TRUE;
+ }
+
return dri_fill_in_modes(screen);
}
diff --git a/src/gallium/state_trackers/osmesa/osmesa.c b/src/gallium/state_trackers/osmesa/osmesa.c
index 5908316dc81..594372bd725 100644
--- a/src/gallium/state_trackers/osmesa/osmesa.c
+++ b/src/gallium/state_trackers/osmesa/osmesa.c
@@ -545,6 +545,7 @@ OSMesaCreateContextExt(GLenum format, GLint depthBits, GLint stencilBits,
attribs.options.force_glsl_extensions_warn = FALSE;
attribs.options.disable_blend_func_extended = FALSE;
attribs.options.disable_glsl_line_continuations = FALSE;
+ attribs.options.force_s3tc_enable = FALSE;
osmesa_init_st_visual(&attribs.visual,
PIPE_FORMAT_R8G8B8A8_UNORM,