Mesa (master): mesa: avoid redundant state setting in glClientActiveTexture

Brian Paul brianp at kemper.freedesktop.org
Tue Oct 27 23:00:59 UTC 2009


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

Author: Brian Paul <brianp at vmware.com>
Date:   Tue Oct 27 13:51:51 2009 -0600

mesa: avoid redundant state setting in glClientActiveTexture

Plus add code for verbose/debugging.

---

 src/mesa/main/texstate.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c
index 16492bd..c735e18 100644
--- a/src/mesa/main/texstate.c
+++ b/src/mesa/main/texstate.c
@@ -318,11 +318,18 @@ _mesa_ClientActiveTextureARB(GLenum texture)
    GLuint texUnit = texture - GL_TEXTURE0;
    ASSERT_OUTSIDE_BEGIN_END(ctx);
 
+   if (MESA_VERBOSE & (VERBOSE_API | VERBOSE_TEXTURE))
+      _mesa_debug(ctx, "glClientActiveTexture %s\n",
+                  _mesa_lookup_enum_by_nr(texture));
+
    if (texUnit >= ctx->Const.MaxTextureCoordUnits) {
       _mesa_error(ctx, GL_INVALID_ENUM, "glClientActiveTexture(texture)");
       return;
    }
 
+   if (ctx->Array.ActiveTexture == texUnit)
+      return;
+
    FLUSH_VERTICES(ctx, _NEW_ARRAY);
    ctx->Array.ActiveTexture = texUnit;
 }




More information about the mesa-commit mailing list