GLuint k;
GET_CURRENT_CONTEXT(ctx);
- k = _mesa_max_tex_unit(ctx);
-
- assert(k <= ARRAY_SIZE(ctx->Texture.Unit));
-
if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
_mesa_debug(ctx, "glActiveTexture %s\n",
_mesa_enum_to_string(texture));
+ if (ctx->Texture.CurrentUnit == texUnit)
+ return;
+
+ k = _mesa_max_tex_unit(ctx);
+
+ assert(k <= ARRAY_SIZE(ctx->Texture.Unit));
+
if (texUnit >= k) {
_mesa_error(ctx, GL_INVALID_ENUM, "glActiveTexture(texture=%s)",
_mesa_enum_to_string(texture));
return;
}
- if (ctx->Texture.CurrentUnit == texUnit)
- return;
-
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
ctx->Texture.CurrentUnit = texUnit;
_mesa_debug(ctx, "glClientActiveTexture %s\n",
_mesa_enum_to_string(texture));
+ if (ctx->Array.ActiveTexture == texUnit)
+ return;
+
if (texUnit >= ctx->Const.MaxTextureCoordUnits) {
_mesa_error(ctx, GL_INVALID_ENUM, "glClientActiveTexture(texture)");
return;
}
- if (ctx->Array.ActiveTexture == texUnit)
- return;
-
FLUSH_VERTICES(ctx, _NEW_ARRAY);
ctx->Array.ActiveTexture = texUnit;
}