diff options
author | Jason Ekstrand <jason.ekstrand@intel.com> | 2015-01-15 09:31:18 -0800 |
---|---|---|
committer | Jason Ekstrand <jason.ekstrand@intel.com> | 2015-01-15 13:21:27 -0800 |
commit | 153b8b35257fb5d68735b5e43e48b0cdb8b15170 (patch) | |
tree | 05db6c87edc7a57a0b7b3457a35448962b4c1c76 /src/mesa/drivers/dri/i965/intel_fbo.c | |
parent | 4c99e3ae78ed3524d188f00b558f803a943aaa00 (diff) | |
download | external_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/drivers/dri/i965/intel_fbo.c')
-rw-r--r-- | src/mesa/drivers/dri/i965/intel_fbo.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/mesa/drivers/dri/i965/intel_fbo.c b/src/mesa/drivers/dri/i965/intel_fbo.c index 77d1282..d12f4ae 100644 --- a/src/mesa/drivers/dri/i965/intel_fbo.c +++ b/src/mesa/drivers/dri/i965/intel_fbo.c @@ -1008,7 +1008,7 @@ brw_render_cache_set_clear(struct brw_context *brw) void brw_render_cache_set_add_bo(struct brw_context *brw, drm_intel_bo *bo) { - _mesa_set_add(brw->render_cache, _mesa_hash_pointer(bo), bo); + _mesa_set_add(brw->render_cache, bo); } /** @@ -1026,7 +1026,7 @@ brw_render_cache_set_add_bo(struct brw_context *brw, drm_intel_bo *bo) void brw_render_cache_set_check_flush(struct brw_context *brw, drm_intel_bo *bo) { - if (!_mesa_set_search(brw->render_cache, _mesa_hash_pointer(bo), bo)) + if (!_mesa_set_search(brw->render_cache, bo)) return; intel_batchbuffer_emit_mi_flush(brw); @@ -1050,5 +1050,6 @@ intel_fbo_init(struct brw_context *brw) dd->EGLImageTargetRenderbufferStorage = intel_image_target_renderbuffer_storage; - brw->render_cache = _mesa_set_create(brw, _mesa_key_pointer_equal); + brw->render_cache = _mesa_set_create(brw, _mesa_hash_pointer, + _mesa_key_pointer_equal); } |