static GLboolean
set_extension( struct gl_context *ctx, const char *name, GLboolean state )
{
+ size_t offset;
+
if (ctx->Extensions.String) {
/* The string was already queried - can't change it now! */
_mesa_problem(ctx, "Trying to enable/disable extension after glGetString(GL_EXTENSIONS): %s", name);
return GL_FALSE;
}
- size_t offset = name_to_offset(name);
+ offset = name_to_offset(name);
if (offset == 0) {
_mesa_problem(ctx, "Trying to enable/disable unknown extension %s",
name);
GLboolean
_mesa_extension_is_enabled( struct gl_context *ctx, const char *name )
{
+ size_t offset;
+ GLboolean *base;
+
if (name == 0)
return GL_FALSE;
- size_t offset = name_to_offset(name);
+ offset = name_to_offset(name);
if (offset == 0)
return GL_FALSE;
- GLboolean *base = (GLboolean *) &ctx->Extensions;
+ base = (GLboolean *) &ctx->Extensions;
return base[offset];
}
GLuint
_mesa_get_extension_count(struct gl_context *ctx)
{
+ GLboolean *base;
+
/* only count once */
if (ctx->Extensions.Count != 0)
return ctx->Extensions.Count;
- GLboolean *base = (GLboolean *) &ctx->Extensions;
+ base = (GLboolean *) &ctx->Extensions;
for (const struct extension *i = extension_table; i->name != 0; ++i) {
if (base[i->offset]) {
ctx->Extensions.Count++;
const GLubyte *
_mesa_get_enabled_extension(struct gl_context *ctx, GLuint index)
{
+ const GLboolean *base;
+ size_t n;
+
if (index < 0)
return NULL;
- const GLboolean *base = (GLboolean*) &ctx->Extensions;
- size_t n = 0;
+ base = (GLboolean*) &ctx->Extensions;
+ n = 0;
for (const struct extension *i = extension_table; i->name != 0; ++i) {
if (n == index && base[i->offset]) {
return (GLubyte*) i->name;