const GLuint maxLevel = texObj->MaxLevel;
const GLint maxLevelSave = texObj->MaxLevel;
const GLboolean genMipmapSave = texObj->GenerateMipmap;
- const GLuint currentTexUnitSave = ctx->Texture.CurrentUnit;
const GLboolean use_glsl_version = ctx->Extensions.ARB_vertex_shader &&
ctx->Extensions.ARB_fragment_shader;
GLenum faceTarget;
samplerSave = ctx->Texture.Unit[ctx->Texture.CurrentUnit].Sampler ?
ctx->Texture.Unit[ctx->Texture.CurrentUnit].Sampler->Name : 0;
- if (currentTexUnitSave != 0)
- _mesa_BindTexture(target, texObj->Name);
+ /* We may have been called from glGenerateTextureMipmap with CurrentUnit
+ * still set to 0, so we don't know when we can skip binding the texture.
+ * Assume that _mesa_BindTexture will be fast if we're rebinding the same
+ * texture.
+ */
+ _mesa_BindTexture(target, texObj->Name);
if (!mipmap->Sampler) {
_mesa_GenSamplers(1, &mipmap->Sampler);