summaryrefslogtreecommitdiff
path: root/src/mesa/pipe/cso_cache
diff options
context:
space:
mode:
authorZack Rusin <zack@tungstengraphics.com>2007-09-18 13:24:44 -0400
committerZack Rusin <zack@tungstengraphics.com>2007-09-18 13:24:44 -0400
commitccd63b54cfbb6bb241d55f7ac95afcd14819f469 (patch)
tree3ea07838de79877e6d441506cdd6f805fcb9d308 /src/mesa/pipe/cso_cache
parent498a1b5dc4ca431bb1de45d04140bfb2ac319ab2 (diff)
Convert shader to an immutable state object.
Diffstat (limited to 'src/mesa/pipe/cso_cache')
-rw-r--r--src/mesa/pipe/cso_cache/cso_cache.c13
-rw-r--r--src/mesa/pipe/cso_cache/cso_cache.h4
2 files changed, 12 insertions, 5 deletions
diff --git a/src/mesa/pipe/cso_cache/cso_cache.c b/src/mesa/pipe/cso_cache/cso_cache.c
index 4aaadf00e6..be653d9494 100644
--- a/src/mesa/pipe/cso_cache/cso_cache.c
+++ b/src/mesa/pipe/cso_cache/cso_cache.c
@@ -80,6 +80,8 @@ static struct cso_hash *_cso_hash_for_type(struct cso_cache *sc, enum cso_cache_
hash = sc->depth_stencil_hash;
case CSO_RASTERIZER:
hash = sc->rasterizer_hash;
+ case CSO_SHADER:
+ hash = sc->shader_hash;
}
return hash;
@@ -96,6 +98,8 @@ static int _cso_size_for_type(enum cso_cache_type type)
return sizeof(struct pipe_depth_stencil_state);
case CSO_RASTERIZER:
return sizeof(struct pipe_rasterizer_state);
+ case CSO_SHADER:
+ return sizeof(struct pipe_shader_state);
}
return 0;
}
@@ -144,10 +148,11 @@ struct cso_cache *cso_cache_create(void)
{
struct cso_cache *sc = malloc(sizeof(struct cso_cache));
- sc->blend_hash = cso_hash_create();
- sc->sampler_hash = cso_hash_create();
+ sc->blend_hash = cso_hash_create();
+ sc->sampler_hash = cso_hash_create();
sc->depth_stencil_hash = cso_hash_create();
- sc->rasterizer_hash = cso_hash_create();
+ sc->rasterizer_hash = cso_hash_create();
+ sc->shader_hash = cso_hash_create();
return sc;
}
@@ -159,6 +164,6 @@ void cso_cache_delete(struct cso_cache *sc)
cso_hash_delete(sc->sampler_hash);
cso_hash_delete(sc->depth_stencil_hash);
cso_hash_delete(sc->rasterizer_hash);
+ cso_hash_delete(sc->shader_hash);
free(sc);
}
-
diff --git a/src/mesa/pipe/cso_cache/cso_cache.h b/src/mesa/pipe/cso_cache/cso_cache.h
index 23be9cd713..d9793ca855 100644
--- a/src/mesa/pipe/cso_cache/cso_cache.h
+++ b/src/mesa/pipe/cso_cache/cso_cache.h
@@ -44,13 +44,15 @@ struct cso_cache {
struct cso_hash *sampler_hash;
struct cso_hash *depth_stencil_hash;
struct cso_hash *rasterizer_hash;
+ struct cso_hash *shader_hash;
};
enum cso_cache_type {
CSO_BLEND,
CSO_SAMPLER,
CSO_DEPTH_STENCIL,
- CSO_RASTERIZER
+ CSO_RASTERIZER,
+ CSO_SHADER
};
unsigned cso_construct_key(void *item, int item_size);