Mesa (mesa_7_7_branch): meta: Bind texture to unit 0 for mipmap generation

Ian Romanick idr at kemper.freedesktop.org
Wed Dec 9 11:11:10 PST 2009


Module: Mesa
Branch: mesa_7_7_branch
Commit: e3fa700c178e11e6735430119232919176ab7b42
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=e3fa700c178e11e6735430119232919176ab7b42

Author: Ian Romanick <ian.d.romanick at intel.com>
Date:   Wed Dec  9 11:03:49 2009 -0800

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 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index a431519..39b0ab1 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;



More information about the mesa-commit mailing list