summaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker/st_cache.c
diff options
context:
space:
mode:
authorZack Rusin <[email protected]>2007-09-17 09:47:41 -0400
committerZack Rusin <[email protected]>2007-09-18 06:31:22 -0400
commitf117327a3f246713abfd4dc4320d4a1a7f1b811a (patch)
tree81c5c58c0ae0685c917996ad04f10003aa95cfa3 /src/mesa/state_tracker/st_cache.c
parente16c045b83f5c5b4f4064df67623bb76b46b6619 (diff)
Make sampler an immutable state object.
Switch the sample to be an immutable state object.
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 0205b1cab32..99fb45f00a6 100644
--- a/src/mesa/state_tracker/st_cache.c
+++ b/src/mesa/state_tracker/st_cache.c
@@ -59,3 +59,20 @@ struct pipe_blend_state * st_cached_blend_state(
}
return (struct pipe_blend_state*)(cso_hash_iter_data(iter));
}
+
+struct pipe_sampler_state * st_cached_sampler_state(
+ struct st_context *st,
+ const struct pipe_sampler_state *sampler)
+{
+ unsigned hash_key = cso_construct_key((void*)sampler, sizeof(struct pipe_sampler_state));
+ struct cso_hash_iter iter = cso_find_state_template(st->cache,
+ hash_key, CSO_SAMPLER,
+ (void*)sampler);
+ if (cso_hash_iter_is_null(iter)) {
+ const struct pipe_sampler_state *created_state = st->pipe->create_sampler_state(
+ st->pipe, sampler);
+ iter = cso_insert_state(st->cache, hash_key, CSO_SAMPLER,
+ (void*)created_state);
+ }
+ return (struct pipe_sampler_state*)(cso_hash_iter_data(iter));
+}