mesa: avoid redundant state setting in glClientActiveTexture
authorBrian Paul <brianp@vmware.com>
Tue, 27 Oct 2009 19:51:51 +0000 (13:51 -0600)
committerBrian Paul <brianp@vmware.com>
Tue, 27 Oct 2009 23:00:31 +0000 (17:00 -0600)
Plus add code for verbose/debugging.

src/mesa/main/texstate.c

index 16492bd7bcf3295cb57754675932ba89c09fd46a..c735e18affbea16ba73ad52025d556dc3c8cef38 100644 (file)
@@ -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;
 }