summaryrefslogtreecommitdiff
path: root/src/mesa/state_tracker/st_cache.c
diff options
context:
space:
mode:
authorZack Rusin <zack@tungstengraphics.com>2007-09-17 11:55:18 -0400
committerZack Rusin <zack@tungstengraphics.com>2007-09-18 06:31:22 -0400
commitd6ac959833a8e40a27907940969c622692f749b1 (patch)
treeddb0c6d886142d66aabb27a3ca00c683f55dbc4c /src/mesa/state_tracker/st_cache.c
parent56edb98d975041cca2e4a3712126b151d80a045a (diff)
Combing depth and stencil objects and making them immutable.
Converting depth and stencil objects into a single state object (d3d10 like) and making it immutable.
Diffstat (limited to 'src/mesa/state_tracker/st_cache.c')
-rw-r--r--src/mesa/state_tracker/st_cache.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/mesa/state_tracker/st_cache.c b/src/mesa/state_tracker/st_cache.c
index 99fb45f00a..64c03be99d 100644
--- a/src/mesa/state_tracker/st_cache.c
+++ b/src/mesa/state_tracker/st_cache.c
@@ -76,3 +76,20 @@ struct pipe_sampler_state * st_cached_sampler_state(
}
return (struct pipe_sampler_state*)(cso_hash_iter_data(iter));
}
+
+struct pipe_depth_stencil_state * st_cached_depth_stencil_state(
+ struct st_context *st,
+ const struct pipe_depth_stencil_state *depth_stencil)
+{
+ unsigned hash_key = cso_construct_key((void*)depth_stencil, sizeof(struct pipe_depth_stencil_state));
+ struct cso_hash_iter iter = cso_find_state_template(st->cache,
+ hash_key, CSO_DEPTH_STENCIL,
+ (void*)depth_stencil);
+ if (cso_hash_iter_is_null(iter)) {
+ const struct pipe_depth_stencil_state *created_state = st->pipe->create_depth_stencil_state(
+ st->pipe, depth_stencil);
+ iter = cso_insert_state(st->cache, hash_key, CSO_DEPTH_STENCIL,
+ (void*)created_state);
+ }
+ return (struct pipe_depth_stencil_state*)(cso_hash_iter_data(iter));
+}