summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJordan Justen <[email protected]>2014-06-07 20:12:20 -0700
committerJordan Justen <[email protected]>2014-06-16 09:54:52 -0700
commit8be64fb570b15be1f2daf3545b5e9c3299704914 (patch)
tree337d36855630b0b917c7376578637eace7fea390 /src
parentf2280eeba5599ae3b0d3a8ef188be0590bf78e69 (diff)
main/extensions: Create a context-less set_extensions function
We will add new gl_extensions structures that capture the environment variable extension overrides and are available early in context creation. This will allow a driver to take actions during its initialization based on the extension overrides. Signed-off-by: Jordan Justen <[email protected]> Reviewed-by: Anuj Phogat <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/mesa/main/extensions.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
index 822f8cd64e8..5de6625b88f 100644
--- a/src/mesa/main/extensions.c
+++ b/src/mesa/main/extensions.c
@@ -475,10 +475,27 @@ _mesa_enable_sw_extensions(struct gl_context *ctx)
/**
* Either enable or disable the named extension.
+ * \return offset of extensions withint `ext' or 0 if extension is not known
+ */
+static size_t
+set_extension(struct gl_extensions *ext, const char *name, GLboolean state)
+{
+ size_t offset;
+
+ offset = name_to_offset(name);
+ if (offset != 0 && (offset != o(dummy_true) || state != GL_FALSE)) {
+ ((GLboolean *) ext)[offset] = state;
+ }
+
+ return offset;
+}
+
+/**
+ * Either enable or disable the named extension.
* \return GL_TRUE for success, GL_FALSE if invalid extension name
*/
static GLboolean
-set_extension( struct gl_context *ctx, const char *name, GLboolean state )
+set_ctx_extension(struct gl_context *ctx, const char *name, GLboolean state)
{
size_t offset;
@@ -489,7 +506,7 @@ set_extension( struct gl_context *ctx, const char *name, GLboolean state )
return GL_FALSE;
}
- offset = name_to_offset(name);
+ offset = set_extension(&ctx->Extensions, name, state);
if (offset == 0) {
_mesa_problem(ctx, "Trying to enable/disable unknown extension %s",
name);
@@ -499,8 +516,6 @@ set_extension( struct gl_context *ctx, const char *name, GLboolean state )
"%s", name);
return GL_FALSE;
} else {
- GLboolean *base = (GLboolean *) &ctx->Extensions;
- base[offset] = state;
return GL_TRUE;
}
}
@@ -554,7 +569,7 @@ get_extension_override( struct gl_context *ctx )
enable = 1;
break;
}
- recognized = set_extension(ctx, ext, enable);
+ recognized = set_ctx_extension(ctx, ext, enable);
if (!recognized && enable) {
strcat(extra_exts, ext);
strcat(extra_exts, " ");