Mesa (master): mesa: optimize most _mesa_ActiveTexture calls in glPopAttrib

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sat Jan 30 21:52:58 UTC 2021


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

Author: Marek Olšák <marek.olsak at amd.com>
Date:   Sat Dec 19 03:04:45 2020 -0500

mesa: optimize most _mesa_ActiveTexture calls in glPopAttrib

_mesa_ActiveTexture changes CurrentUnit and the texture matrix stack
if the matrix mode is a texture matrix. In these cases, the texture matrix
stack is not touched.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8181>

---

 src/mesa/main/attrib.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c
index 0002be808f6..7229b3f1a18 100644
--- a/src/mesa/main/attrib.c
+++ b/src/mesa/main/attrib.c
@@ -466,7 +466,7 @@ pop_enable_group(struct gl_context *ctx, const struct gl_enable_attrib_node *ena
       if (old_enabled == enabled && old_gen_enabled == gen_enabled)
          continue;
 
-      _mesa_ActiveTexture(GL_TEXTURE0 + i);
+      ctx->Texture.CurrentUnit = i;
 
       if (old_enabled != enabled) {
          TEST_AND_UPDATE_BIT(old_enabled, enabled, TEXTURE_1D_INDEX, GL_TEXTURE_1D);
@@ -490,7 +490,7 @@ pop_enable_group(struct gl_context *ctx, const struct gl_enable_attrib_node *ena
       }
    }
 
-   _mesa_ActiveTexture(GL_TEXTURE0 + curTexUnitSave);
+   ctx->Texture.CurrentUnit = curTexUnitSave;
 }
 
 
@@ -511,7 +511,7 @@ pop_texture_group(struct gl_context *ctx, struct gl_texture_attrib_node *texstat
          &ctx->Texture.FixedFuncUnit[u];
       GLuint tgt;
 
-      _mesa_ActiveTexture(GL_TEXTURE0_ARB + u);
+      ctx->Texture.CurrentUnit = u;
 
       if (ctx->Driver.TexEnv || ctx->Driver.TexGen) {
          /* Slow path for legacy classic drivers. */



More information about the mesa-commit mailing list