summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/cso_cache/cso_cache.c
diff options
context:
space:
mode:
authorJosé Fonseca <jrfonseca@tungstengraphics.com>2008-02-22 17:22:32 +0900
committerJosé Fonseca <jrfonseca@tungstengraphics.com>2008-02-23 00:51:33 +0900
commit6c597238b2e168b63738ac8cc9167c1d09185aad (patch)
tree7413113fc37c241a04b1703c90f3e27408643f6d /src/gallium/auxiliary/cso_cache/cso_cache.c
parent2cf860b866d80595b7287d6991dc96abc3ca8dd3 (diff)
downloadexternal_mesa3d-6c597238b2e168b63738ac8cc9167c1d09185aad.zip
external_mesa3d-6c597238b2e168b63738ac8cc9167c1d09185aad.tar.gz
external_mesa3d-6c597238b2e168b63738ac8cc9167c1d09185aad.tar.bz2
gallium: Add cso convenience routine (from Keith's patch).
Diffstat (limited to 'src/gallium/auxiliary/cso_cache/cso_cache.c')
-rw-r--r--src/gallium/auxiliary/cso_cache/cso_cache.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/cso_cache/cso_cache.c b/src/gallium/auxiliary/cso_cache/cso_cache.c
index 9e77e07..776ce6b 100644
--- a/src/gallium/auxiliary/cso_cache/cso_cache.c
+++ b/src/gallium/auxiliary/cso_cache/cso_cache.c
@@ -132,6 +132,26 @@ cso_find_state(struct cso_cache *sc,
return cso_hash_find(hash, hash_key);
}
+
+void *cso_hash_find_data_from_template( struct cso_hash *hash,
+ unsigned hash_key,
+ void *templ,
+ int size )
+{
+ struct cso_hash_iter iter = cso_hash_find(hash, hash_key);
+ while (!cso_hash_iter_is_null(iter)) {
+ void *iter_data = cso_hash_iter_data(iter);
+ if (!memcmp(iter_data, templ, size)) {
+ /* Return the payload:
+ */
+ return (unsigned char *)iter_data + size;
+ }
+ iter = cso_hash_iter_next(iter);
+ }
+ return NULL;
+}
+
+
struct cso_hash_iter cso_find_state_template(struct cso_cache *sc,
unsigned hash_key, enum cso_cache_type type,
void *templ)