summaryrefslogtreecommitdiff
path: root/src/mesa/state_tracker/st_cache.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/state_tracker/st_cache.c')
-rw-r--r--src/mesa/state_tracker/st_cache.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/src/mesa/state_tracker/st_cache.c b/src/mesa/state_tracker/st_cache.c
index 7b851e3901..d84a396e18 100644
--- a/src/mesa/state_tracker/st_cache.c
+++ b/src/mesa/state_tracker/st_cache.c
@@ -112,19 +112,37 @@ struct pipe_rasterizer_state * st_cached_rasterizer_state(
return (struct pipe_rasterizer_state*)(cso_hash_iter_data(iter));
}
-struct pipe_shader_state * st_cached_shader_state(
+struct pipe_shader_state * st_cached_fs_state(
struct st_context *st,
const struct pipe_shader_state *templ)
{
unsigned hash_key = cso_construct_key((void*)templ,
sizeof(struct pipe_shader_state));
struct cso_hash_iter iter = cso_find_state_template(st->cache,
- hash_key, CSO_SHADER,
+ hash_key, CSO_FRAGMENT_SHADER,
(void*)templ);
if (cso_hash_iter_is_null(iter)) {
const struct pipe_shader_state *created_state =
- st->pipe->create_shader_state(st->pipe, templ);
- iter = cso_insert_state(st->cache, hash_key, CSO_SHADER,
+ st->pipe->create_fs_state(st->pipe, templ);
+ iter = cso_insert_state(st->cache, hash_key, CSO_FRAGMENT_SHADER,
+ (void*)created_state);
+ }
+ return (struct pipe_shader_state*)(cso_hash_iter_data(iter));
+}
+
+struct pipe_shader_state * st_cached_vs_state(
+ struct st_context *st,
+ const struct pipe_shader_state *templ)
+{
+ unsigned hash_key = cso_construct_key((void*)templ,
+ sizeof(struct pipe_shader_state));
+ struct cso_hash_iter iter = cso_find_state_template(st->cache,
+ hash_key, CSO_VERTEX_SHADER,
+ (void*)templ);
+ if (cso_hash_iter_is_null(iter)) {
+ const struct pipe_shader_state *created_state =
+ st->pipe->create_vs_state(st->pipe, templ);
+ iter = cso_insert_state(st->cache, hash_key, CSO_VERTEX_SHADER,
(void*)created_state);
}
return (struct pipe_shader_state*)(cso_hash_iter_data(iter));