const GLenum wrapTSave = texObj->WrapT;
const GLenum wrapRSave = texObj->WrapR;
const GLuint fboSave = ctx->DrawBuffer->Name;
+ const GLuint original_active_unit = ctx->Texture.CurrentUnit;
GLenum faceTarget;
GLuint dstLevel;
GLuint border = 0;
/* texture is already locked, unlock now */
_mesa_unlock_texture(ctx, texObj);
+ if (original_active_unit != 0)
+ _mesa_BindTexture(target, texObj->Name);
+
for (dstLevel = baseLevel + 1; dstLevel <= maxLevel; dstLevel++) {
const struct gl_texture_image *srcImage;
const GLuint srcLevel = dstLevel - 1;