util_dl_proc fetch_2d_texel_rgba_dxt3;
util_dl_proc fetch_2d_texel_rgba_dxt5;
util_dl_proc tx_compress_dxtn;
- char *force_s3tc_enable;
if (!first_time)
return;
library = util_dl_open(DXTN_LIBNAME);
if (!library) {
- if ((force_s3tc_enable = getenv("force_s3tc_enable")) &&
- !strcmp(force_s3tc_enable, "true")) {
- debug_printf("couldn't open " DXTN_LIBNAME ", enabling DXTn due to "
- "force_s3tc_enable=true environment variable\n");
- util_format_s3tc_enabled = TRUE;
- } else {
- debug_printf("couldn't open " DXTN_LIBNAME ", software DXTn "
- "compression/decompression unavailable\n");
- }
+ debug_printf("couldn't open " DXTN_LIBNAME ", software DXTn "
+ "compression/decompression unavailable\n");
return;
}
boolean force_glsl_extensions_warn;
boolean disable_glsl_line_continuations;
boolean disable_blend_func_extended;
+ boolean force_s3tc_enable;
};
/**
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
#include "state_tracker/drm_driver.h"
#include "util/u_debug.h"
+#include "util/u_format_s3tc.h"
#define MSAA_VISUAL_MAX_SAMPLES 32
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)
#define false 0
-static const uint __driNConfigOptions = 12;
+static const uint __driNConfigOptions = 13;
static const __DRIconfig **
dri_fill_in_modes(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);
}
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,
}
-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;
-}
-
/**
* Given a member \c x of struct gl_extensions, return offset of
* \c x in bytes.
/* Below are the cases which cannot be moved into tables easily. */
- if (!ctx->Mesa_DXTn && !st_get_s3tc_override()) {
+ if (!ctx->Mesa_DXTn && !st->options.force_s3tc_enable) {
ctx->Extensions.EXT_texture_compression_s3tc = GL_FALSE;
ctx->Extensions.ANGLE_texture_compression_dxt = GL_FALSE;
}