diff options
author | Zack Rusin <zack@tungstengraphics.com> | 2007-09-17 07:56:56 -0400 |
---|---|---|
committer | Zack Rusin <zack@tungstengraphics.com> | 2007-09-18 06:31:22 -0400 |
commit | e16c045b83f5c5b4f4064df67623bb76b46b6619 (patch) | |
tree | 9c38e12f21e6175ba7c2b81c4a551d8b1eae5808 /src/mesa/cso_cache/cso_cache.h | |
parent | 9780327c5d95586a88fce94d7b47342355ead118 (diff) |
Implementing a better hash, removing state_tracker dependency from the cache.
Replacing mesa's main hash with one that handles collisions, moving state_tracker
related caching to the state tracker to keep cso cache independent of it. Cleanups.
Diffstat (limited to 'src/mesa/cso_cache/cso_cache.h')
-rw-r--r-- | src/mesa/cso_cache/cso_cache.h | 43 |
1 files changed, 17 insertions, 26 deletions
diff --git a/src/mesa/cso_cache/cso_cache.h b/src/mesa/cso_cache/cso_cache.h index ca0a2d576a..c022b98d43 100644 --- a/src/mesa/cso_cache/cso_cache.h +++ b/src/mesa/cso_cache/cso_cache.h @@ -33,43 +33,34 @@ #ifndef CSO_CACHE_H #define CSO_CACHE_H -#include "state_tracker/st_context.h" #include "pipe/p_context.h" #include "pipe/p_state.h" -#include "main/hash.h" - -struct cso_cache_item { - unsigned key; - - unsigned state_size; - const void *state; - - struct cso_cache_item *next; -}; +struct cso_hash; struct cso_cache { - struct _mesa_HashTable *hash; + struct cso_hash *blend_hash; }; -void cso_cache_destroy(struct cso_cache *sc); -struct cso_cache *cso_cache_create(void); +enum cso_cache_type { + CSO_BLEND, +}; unsigned cso_construct_key(void *item, int item_size); -struct cso_cache_item *cso_insert_state(struct cso_cache *sc, - unsigned hash_key, - void *state, int state_size); -struct cso_cache_item *cso_find_state(struct cso_cache *sc, - unsigned hash_key, - void *state, int state_size); -struct cso_cache_item *cso_remove_state(struct cso_cache *sc, - unsigned hash_key, - void *state, int state_size); +struct cso_cache *cso_cache_create(void); +void cso_cache_delete(struct cso_cache *sc); -struct pipe_blend_state *cso_cached_blend_state( - struct st_context *pipe, - const struct pipe_blend_state *state); +struct cso_hash_iter cso_insert_state(struct cso_cache *sc, + unsigned hash_key, enum cso_cache_type type, + void *state); +struct cso_hash_iter cso_find_state(struct cso_cache *sc, + unsigned hash_key, enum cso_cache_type type); +struct cso_hash_iter cso_find_state_template(struct cso_cache *sc, + unsigned hash_key, enum cso_cache_type type, + void *templ); +void * cso_take_state(struct cso_cache *sc, unsigned hash_key, + enum cso_cache_type type); #endif |