From e3fa700c178e11e6735430119232919176ab7b42 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Wed, 9 Dec 2009 11:03:49 -0800 Subject: meta: Bind texture to unit 0 for mipmap generation If the active texture unit on entry to mipmap generation is not zero, bind the texture to unit zero. Fixes bug #24219. --- src/mesa/drivers/common/meta.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index a431519143..39b0ab13c6 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -2149,6 +2149,7 @@ _mesa_meta_GenerateMipmap(GLcontext *ctx, GLenum target, 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; @@ -2288,6 +2289,9 @@ _mesa_meta_GenerateMipmap(GLcontext *ctx, GLenum target, /* 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; -- cgit v1.2.3