From: Ian Romanick Date: Wed, 9 Dec 2009 19:03:49 +0000 (-0800) Subject: meta: Bind texture to unit 0 for mipmap generation X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e3fa700c178e11e6735430119232919176ab7b42;p=mesa.git 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. --- diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index a4315191434..39b0ab13c6b 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;