summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/cso_cache/cso_cache.c
diff options
context:
space:
mode:
authorZack Rusin <zack@tungstengraphics.com>2008-02-26 00:15:55 -0500
committerZack Rusin <zack@tungstengraphics.com>2008-02-26 01:51:46 -0500
commitbf1c2f3602038440ffacf7ae494cb4e9bacc9bb9 (patch)
tree08584a9614a701064803273b900dbc68d771d717 /src/gallium/auxiliary/cso_cache/cso_cache.c
parent6abb82da7e676384e7e2c9732307b23f8ed7157d (diff)
downloadexternal_mesa3d-bf1c2f3602038440ffacf7ae494cb4e9bacc9bb9.zip
external_mesa3d-bf1c2f3602038440ffacf7ae494cb4e9bacc9bb9.tar.gz
external_mesa3d-bf1c2f3602038440ffacf7ae494cb4e9bacc9bb9.tar.bz2
hide cso cache definition and add some initial code for size limiting
the caches
Diffstat (limited to 'src/gallium/auxiliary/cso_cache/cso_cache.c')
-rw-r--r--src/gallium/auxiliary/cso_cache/cso_cache.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/cso_cache/cso_cache.c b/src/gallium/auxiliary/cso_cache/cso_cache.c
index 9aa1a64..1b870c8 100644
--- a/src/gallium/auxiliary/cso_cache/cso_cache.c
+++ b/src/gallium/auxiliary/cso_cache/cso_cache.c
@@ -33,6 +33,17 @@
#include "cso_cache.h"
#include "cso_hash.h"
+
+struct cso_cache {
+ struct cso_hash *blend_hash;
+ struct cso_hash *depth_stencil_hash;
+ struct cso_hash *fs_hash;
+ struct cso_hash *vs_hash;
+ struct cso_hash *rasterizer_hash;
+ struct cso_hash *sampler_hash;
+ int max_size;
+};
+
#if 1
static unsigned hash_key(const void *key, unsigned key_size)
{
@@ -180,6 +191,7 @@ struct cso_cache *cso_cache_create(void)
{
struct cso_cache *sc = MALLOC_STRUCT(cso_cache);
+ sc->max_size = 4096;
sc->blend_hash = cso_hash_create();
sc->sampler_hash = cso_hash_create();
sc->depth_stencil_hash = cso_hash_create();
@@ -289,3 +301,13 @@ void cso_cache_delete(struct cso_cache *sc)
FREE(sc);
}
+void cso_set_maximum_cache_size(struct cso_cache *sc, int number)
+{
+ sc->max_size = number;
+}
+
+int cso_maximum_cache_size(const struct cso_cache *sc)
+{
+ return sc->max_size;
+}
+