summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2009-12-09 11:03:49 -0800
committerIan Romanick <[email protected]>2009-12-09 11:05:15 -0800
commite3fa700c178e11e6735430119232919176ab7b42 (patch)
tree39c3f18e79882bf6922f2f2ca3549ccc2a8eac49
parentcd6b8dd9e82fedc55d033131fbc0f8ee950567c8 (diff)
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.
-rw-r--r--src/mesa/drivers/common/meta.c4
1 files changed, 4 insertions, 0 deletions
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;