mesa: remove a line of dead code
[mesa.git] / src / mesa / main / texstate.c
index 861c5f37c4e1f9895c2a7fa34333cde073aab904..c735e18affbea16ba73ad52025d556dc3c8cef38 100644 (file)
@@ -31,9 +31,7 @@
 #include "glheader.h"
 #include "mfeatures.h"
 #include "colormac.h"
-#if FEATURE_colortable
 #include "colortab.h"
-#endif
 #include "context.h"
 #include "enums.h"
 #include "macros.h"
@@ -99,16 +97,22 @@ _mesa_copy_texture_state( const GLcontext *src, GLcontext *dst )
       dst->Texture.Unit[u].BumpTarget = src->Texture.Unit[u].BumpTarget;
       COPY_4V(dst->Texture.Unit[u].RotMatrix, src->Texture.Unit[u].RotMatrix);
 
+      /*
+       * XXX strictly speaking, we should compare texture names/ids and
+       * bind textures in the dest context according to id.  For now, only
+       * copy bindings if the contexts share the same pool of textures to
+       * avoid refcounting bugs.
+       */
+      if (dst->Shared == src->Shared) {
+         /* copy texture object bindings, not contents of texture objects */
+         _mesa_lock_context_textures(dst);
 
-      /* copy texture object bindings, not contents of texture objects */
-      _mesa_lock_context_textures(dst);
-
-      for (tex = 0; tex < NUM_TEXTURE_TARGETS; tex++) {
-         _mesa_reference_texobj(&dst->Texture.Unit[u].CurrentTex[tex],
-                                src->Texture.Unit[u].CurrentTex[tex]);
+         for (tex = 0; tex < NUM_TEXTURE_TARGETS; tex++) {
+            _mesa_reference_texobj(&dst->Texture.Unit[u].CurrentTex[tex],
+                                   src->Texture.Unit[u].CurrentTex[tex]);
+         }
+         _mesa_unlock_context_textures(dst);
       }
-
-      _mesa_unlock_context_textures(dst);
    }
 }
 
@@ -303,10 +307,6 @@ _mesa_ActiveTextureARB(GLenum texture)
       /* update current stack pointer */
       ctx->CurrentStack = &ctx->TextureMatrixStack[texUnit];
    }
-
-   if (ctx->Driver.ActiveTexture) {
-      (*ctx->Driver.ActiveTexture)( ctx, (GLuint) texUnit );
-   }
 }
 
 
@@ -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;
 }
@@ -356,9 +363,6 @@ update_texture_matrices( GLcontext *ctx )
         if (ctx->Texture.Unit[u]._ReallyEnabled &&
             ctx->TextureMatrixStack[u].Top->type != MATRIX_IDENTITY)
            ctx->Texture._TexMatEnabled |= ENABLE_TEXMAT(u);
-
-        if (ctx->Driver.TextureMatrix)
-           ctx->Driver.TextureMatrix( ctx, u, ctx->TextureMatrixStack[u].Top);
       }
    }
 }
@@ -753,9 +757,7 @@ _mesa_init_texture(GLcontext *ctx)
    ctx->Texture.CurrentUnit = 0;      /* multitexture */
    ctx->Texture._EnabledUnits = 0x0;
    ctx->Texture.SharedPalette = GL_FALSE;
-#if FEATURE_colortable
    _mesa_init_colortable(&ctx->Texture.Palette);
-#endif
 
    for (u = 0; u < MAX_TEXTURE_UNITS; u++)
       init_texture_unit(ctx, u);
@@ -796,10 +798,8 @@ _mesa_free_texture_data(GLcontext *ctx)
    for (tgt = 0; tgt < NUM_TEXTURE_TARGETS; tgt++)
       ctx->Driver.DeleteTexture(ctx, ctx->Texture.ProxyTex[tgt]);
 
-#if FEATURE_colortable
    for (u = 0; u < MAX_TEXTURE_IMAGE_UNITS; u++)
       _mesa_free_colortable_data(&ctx->Texture.Unit[u].ColorTable);
-#endif
 }