summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/shared.c
diff options
context:
space:
mode:
authorJason Ekstrand <jason.ekstrand@intel.com>2015-01-15 09:31:18 -0800
committerJason Ekstrand <jason.ekstrand@intel.com>2015-01-15 13:21:27 -0800
commit153b8b35257fb5d68735b5e43e48b0cdb8b15170 (patch)
tree05db6c87edc7a57a0b7b3457a35448962b4c1c76 /src/mesa/main/shared.c
parent4c99e3ae78ed3524d188f00b558f803a943aaa00 (diff)
downloadexternal_mesa3d-153b8b35257fb5d68735b5e43e48b0cdb8b15170.zip
external_mesa3d-153b8b35257fb5d68735b5e43e48b0cdb8b15170.tar.gz
external_mesa3d-153b8b35257fb5d68735b5e43e48b0cdb8b15170.tar.bz2
util/hash_set: Rework the API to know about hashing
Previously, the set API required the user to do all of the hashing of keys as it passed them in. Since the hashing function is intrinsically tied to the comparison function, it makes sense for the hash set to know about it. Also, it makes for a somewhat clumsy API as the user is constantly calling hashing functions many of which have long names. This is especially bad when the standard call looks something like _mesa_set_add(ht, _mesa_pointer_hash(key), key); In the above case, there is no reason why the hash set shouldn't do the hashing for you. We leave the option for you to do your own hashing if it's more efficient, but it's no longer needed. Also, if you do do your own hashing, the hash set will assert that your hash matches what it expects out of the hashing function. This should make it harder to mess up your hashing. This is analygous to 94303a0750 where we did this for hash_table Signed-off-by: Jason Ekstrand <jason.ekstrand@intel.com> Reviewed-by: Matt Turner <mattst88@gmail.com> Reviewed-by: Eric Anholt <eric@anholt.net>
Diffstat (limited to 'src/mesa/main/shared.c')
-rw-r--r--src/mesa/main/shared.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/mesa/main/shared.c b/src/mesa/main/shared.c
index 2389c13..ccf5355 100644
--- a/src/mesa/main/shared.c
+++ b/src/mesa/main/shared.c
@@ -119,7 +119,8 @@ _mesa_alloc_shared_state(struct gl_context *ctx)
shared->FrameBuffers = _mesa_NewHashTable();
shared->RenderBuffers = _mesa_NewHashTable();
- shared->SyncObjects = _mesa_set_create(NULL, _mesa_key_pointer_equal);
+ shared->SyncObjects = _mesa_set_create(NULL, _mesa_hash_pointer,
+ _mesa_key_pointer_equal);
return shared;
}