summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2015-09-02 16:06:58 -0700
committerEmil Velikov <[email protected]>2015-09-11 19:19:32 +0100
commite36ca8c2bb04eb6be6b6a378ed7990baa041e71b (patch)
tree3cf668998d18af7d199f140c40fc2c1a4dd525c0
parent901744b2ff5ef4b6be6f6e8d9a886c5be0640508 (diff)
meta: Always bind the texture
We may have been called from glGenerateTextureMipmap with CurrentUnit still set to 0, so we don't know when we can skip binding the texture. Assume that _mesa_BindTexture will be fast if we're rebinding the same texture. v2: Remove currentTexUnitSave because it is now unused. Suggested by both Neil and Anuj. Signed-off-by: Ian Romanick <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91847 Cc: "11.0" <[email protected]> Reviewed-by: Neil Roberts <[email protected]> Reviewed-by: Anuj Phogat <[email protected]> (cherry picked from commit 767c33e88138afa64443417860b264a494eba33d)
-rw-r--r--src/mesa/drivers/common/meta_generate_mipmap.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/mesa/drivers/common/meta_generate_mipmap.c b/src/mesa/drivers/common/meta_generate_mipmap.c
index 0655f052219..5dc40a2aa33 100644
--- a/src/mesa/drivers/common/meta_generate_mipmap.c
+++ b/src/mesa/drivers/common/meta_generate_mipmap.c
@@ -163,7 +163,6 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target,
const GLuint maxLevel = texObj->MaxLevel;
const GLint maxLevelSave = texObj->MaxLevel;
const GLboolean genMipmapSave = texObj->GenerateMipmap;
- const GLuint currentTexUnitSave = ctx->Texture.CurrentUnit;
const GLboolean use_glsl_version = ctx->Extensions.ARB_vertex_shader &&
ctx->Extensions.ARB_fragment_shader;
GLenum faceTarget;
@@ -202,8 +201,12 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target,
samplerSave = ctx->Texture.Unit[ctx->Texture.CurrentUnit].Sampler ?
ctx->Texture.Unit[ctx->Texture.CurrentUnit].Sampler->Name : 0;
- if (currentTexUnitSave != 0)
- _mesa_BindTexture(target, texObj->Name);
+ /* We may have been called from glGenerateTextureMipmap with CurrentUnit
+ * still set to 0, so we don't know when we can skip binding the texture.
+ * Assume that _mesa_BindTexture will be fast if we're rebinding the same
+ * texture.
+ */
+ _mesa_BindTexture(target, texObj->Name);
if (!mipmap->Sampler) {
_mesa_GenSamplers(1, &mipmap->Sampler);