struct gl_extensions _mesa_extension_override_enables;
struct gl_extensions _mesa_extension_override_disables;
-static char *unrecognized_extensions = NULL;
+#define MAX_UNRECOGNIZED_EXTENSIONS 16
+static struct {
+ char *env;
+ const char *names[MAX_UNRECOGNIZED_EXTENSIONS];
+} unrecognized_extensions;
/**
* Given a member \c x of struct gl_extensions, return offset of
static void
free_unknown_extensions_strings(void)
{
- free(unrecognized_extensions);
+ free(unrecognized_extensions.env);
+ for (int i = 0; i < MAX_UNRECOGNIZED_EXTENSIONS; ++i)
+ unrecognized_extensions.names[i] = NULL;
}
MAX_UNRECOGNIZED_EXTENSIONS);
}
} else {
- ctx->Extensions.unrecognized_extensions[unknown_ext] = ext;
+ unrecognized_extensions.names[unknown_ext] = ext;
unknown_ext++;
-
_mesa_problem(ctx, "Trying to enable unknown extension: %s", ext);
}
}
if (!unknown_ext) {
free(env);
} else {
- unrecognized_extensions = env;
+ unrecognized_extensions.env = env;
atexit(free_unknown_extensions_strings);
}
}
}
}
for (k = 0; k < MAX_UNRECOGNIZED_EXTENSIONS; k++)
- if (ctx->Extensions.unrecognized_extensions[k])
- length += 1 + strlen(ctx->Extensions.unrecognized_extensions[k]); /* +1 for space */
+ if (unrecognized_extensions.names[k])
+ length += 1 + strlen(unrecognized_extensions.names[k]); /* +1 for space */
exts = calloc(ALIGN(length + 1, 4), sizeof(char));
if (exts == NULL) {
strcat(exts, " ");
}
for (j = 0; j < MAX_UNRECOGNIZED_EXTENSIONS; j++) {
- if (ctx->Extensions.unrecognized_extensions[j]) {
- strcat(exts, ctx->Extensions.unrecognized_extensions[j]);
+ if (unrecognized_extensions.names[j]) {
+ strcat(exts, unrecognized_extensions.names[j]);
strcat(exts, " ");
}
}
}
for (k = 0; k < MAX_UNRECOGNIZED_EXTENSIONS; ++k) {
- if (ctx->Extensions.unrecognized_extensions[k])
- ctx->Extensions.Count++;
+ if (unrecognized_extensions.names[k])
+ ctx->Extensions.Count++;
}
return ctx->Extensions.Count;
}
}
for (i = 0; i < MAX_UNRECOGNIZED_EXTENSIONS; ++i) {
- if (ctx->Extensions.unrecognized_extensions[i]) {
+ if (unrecognized_extensions.names[i]) {
if (n == index)
- return (const GLubyte*) ctx->Extensions.unrecognized_extensions[i];
+ return (const GLubyte*) unrecognized_extensions.names[i];
else
++n;
}