aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mesa/main/context.c2
-rw-r--r--src/mesa/main/extensions.c51
-rw-r--r--src/mesa/main/extensions.h6
3 files changed, 59 insertions, 0 deletions
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index f350788500c..244e63edec6 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -396,6 +396,8 @@ one_time_init( struct gl_context *ctx )
assert( sizeof(GLint) == 4 );
assert( sizeof(GLuint) == 4 );
+ _mesa_one_time_init_extension_overrides();
+
_mesa_get_cpu_features();
for (i = 0; i < 256; i++) {
diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
index 5de6625b88f..4659bac686a 100644
--- a/src/mesa/main/extensions.c
+++ b/src/mesa/main/extensions.c
@@ -37,6 +37,9 @@
#include "macros.h"
#include "mtypes.h"
+struct gl_extensions _mesa_extension_override_enables;
+struct gl_extensions _mesa_extension_override_disables;
+
enum {
DISABLE = 0,
GLL = 1 << API_OPENGL_COMPAT, /* GL Legacy / Compatibility */
@@ -588,6 +591,54 @@ get_extension_override( struct gl_context *ctx )
/**
+ * \brief Initialize extension override tables.
+ *
+ * This should be called one time early during first context initialization.
+ */
+void
+_mesa_one_time_init_extension_overrides(void)
+{
+ const char *env_const = _mesa_getenv("MESA_EXTENSION_OVERRIDE");
+ char *env;
+ char *ext;
+ size_t offset;
+
+ memset(&_mesa_extension_override_enables, 0, sizeof(struct gl_extensions));
+ memset(&_mesa_extension_override_disables, 0, sizeof(struct gl_extensions));
+
+ if (env_const == NULL) {
+ return;
+ }
+
+ /* Copy env_const because strtok() is destructive. */
+ env = strdup(env_const);
+ for (ext = strtok(env, " "); ext != NULL; ext = strtok(NULL, " ")) {
+ int enable;
+ switch (ext[0]) {
+ case '+':
+ enable = 1;
+ ++ext;
+ break;
+ case '-':
+ enable = 0;
+ ++ext;
+ break;
+ default:
+ enable = 1;
+ break;
+ }
+
+ offset = set_extension(&_mesa_extension_override_enables, ext, enable);
+ if (offset != 0 && (offset != o(dummy_true) || enable != GL_FALSE)) {
+ ((GLboolean *) &_mesa_extension_override_disables)[offset] = !enable;
+ }
+ }
+
+ free(env);
+}
+
+
+/**
* \brief Initialize extension tables and enable default extensions.
*
* This should be called during context initialization.
diff --git a/src/mesa/main/extensions.h b/src/mesa/main/extensions.h
index a8cc2a41e75..3a404d2e0b3 100644
--- a/src/mesa/main/extensions.h
+++ b/src/mesa/main/extensions.h
@@ -39,9 +39,12 @@
#include "glheader.h"
struct gl_context;
+struct gl_extensions;
extern void _mesa_enable_sw_extensions(struct gl_context *ctx);
+extern void _mesa_one_time_init_extension_overrides(void);
+
extern void _mesa_init_extensions(struct gl_context *ctx);
extern GLubyte *_mesa_make_extension_string(struct gl_context *ctx);
@@ -52,4 +55,7 @@ _mesa_get_extension_count(struct gl_context *ctx);
extern const GLubyte *
_mesa_get_enabled_extension(struct gl_context *ctx, GLuint index);
+extern struct gl_extensions _mesa_extension_override_enables;
+extern struct gl_extensions _mesa_extension_override_disables;
+
#endif