gallium: bypass u_vbuf if it's not needed (no fallbacks and no user VBOs)
[mesa.git] / src / gallium / auxiliary / cso_cache / cso_hash.c
index 288cef7b6faea8472a5687dfe36d564cb8c28556..4d3e261a741f24a96d295d881383923018becb3c 100644 (file)
@@ -1,6 +1,6 @@
 /**************************************************************************
  *
- * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * Copyright 2007 VMware, Inc.
  * All Rights Reserved.
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
@@ -18,7 +18,7 @@
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
  * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -27,7 +27,7 @@
 
  /*
   * Authors:
-  *   Zack Rusin <zack@tungstengraphics.com>
+  *   Zack Rusin <zackr@vmware.com>
   */
 
 #include "util/u_debug.h"
@@ -35,7 +35,9 @@
 
 #include "cso_hash.h"
 
+#ifndef MAX
 #define MAX(a, b) ((a > b) ? (a) : (b))
+#endif
 
 static const int MinNumBits = 4;
 
@@ -71,12 +73,6 @@ static int countBits(int hint)
    return numBits;
 }
 
-struct cso_node {
-   struct cso_node *next;
-   unsigned key;
-   void *value;
-};
-
 struct cso_hash_data {
    struct cso_node *fakeNext;
    struct cso_node **buckets;
@@ -87,13 +83,6 @@ struct cso_hash_data {
    int numBuckets;
 };
 
-struct cso_hash {
-   union {
-      struct cso_hash_data *d;
-      struct cso_node      *e;
-   } data;
-};
-
 static void *cso_data_allocate_node(struct cso_hash_data *hash)
 {
    return MALLOC(hash->nodeSize);
@@ -291,13 +280,6 @@ unsigned cso_hash_iter_key(struct cso_hash_iter iter)
    return iter.node->key;
 }
 
-void * cso_hash_iter_data(struct cso_hash_iter iter)
-{
-   if (!iter.node || iter.hash->data.e == iter.node)
-      return 0;
-   return iter.node->value;
-}
-
 static struct cso_node *cso_hash_data_next(struct cso_node *node)
 {
    union {
@@ -372,13 +354,6 @@ struct cso_hash_iter cso_hash_iter_next(struct cso_hash_iter iter)
    return next;
 }
 
-int cso_hash_iter_is_null(struct cso_hash_iter iter)
-{
-   if (!iter.node || iter.node == iter.hash->data.e)
-      return 1;
-   return 0;
-}
-
 void * cso_hash_take(struct cso_hash *hash,
                       unsigned akey)
 {