summaryrefslogtreecommitdiff
path: root/src/mesa/state_tracker
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r--src/mesa/state_tracker/st_atom_fs.c2
-rw-r--r--src/mesa/state_tracker/st_atom_vs.c2
-rw-r--r--src/mesa/state_tracker/st_cache.c26
-rw-r--r--src/mesa/state_tracker/st_cache.h7
-rw-r--r--src/mesa/state_tracker/st_cb_clear.c4
-rw-r--r--src/mesa/state_tracker/st_cb_drawpixels.c4
6 files changed, 34 insertions, 11 deletions
diff --git a/src/mesa/state_tracker/st_atom_fs.c b/src/mesa/state_tracker/st_atom_fs.c
index 3df2c6750a..6dd576a57c 100644
--- a/src/mesa/state_tracker/st_atom_fs.c
+++ b/src/mesa/state_tracker/st_atom_fs.c
@@ -77,7 +77,7 @@ static void compile_fs( struct st_context *st )
fs.outputs_written
= tgsi_mesa_translate_fragment_output_mask(fp->Base.Base.OutputsWritten);
fs.tokens = &fp->tokens[0];
- cached = st_cached_shader_state(st, &fs);
+ cached = st_cached_fs_state(st, &fs);
fp->fsx = cached;
if (TGSI_DEBUG)
diff --git a/src/mesa/state_tracker/st_atom_vs.c b/src/mesa/state_tracker/st_atom_vs.c
index 8de19e41ee..166dc70b08 100644
--- a/src/mesa/state_tracker/st_atom_vs.c
+++ b/src/mesa/state_tracker/st_atom_vs.c
@@ -104,7 +104,7 @@ static void compile_vs( struct st_context *st )
vs.tokens = &vp->tokens[0];
- cached = st_cached_shader_state(st, &vs);
+ cached = st_cached_vs_state(st, &vs);
vp->vs = cached;
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));
diff --git a/src/mesa/state_tracker/st_cache.h b/src/mesa/state_tracker/st_cache.h
index 6a897a9993..bcbe19b823 100644
--- a/src/mesa/state_tracker/st_cache.h
+++ b/src/mesa/state_tracker/st_cache.h
@@ -53,7 +53,12 @@ struct pipe_rasterizer_state *st_cached_rasterizer_state(
struct st_context *st,
const struct pipe_rasterizer_state *raster);
-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);
+
+
+struct pipe_shader_state *st_cached_vs_state(
struct st_context *st,
const struct pipe_shader_state *templ);
diff --git a/src/mesa/state_tracker/st_cb_clear.c b/src/mesa/state_tracker/st_cb_clear.c
index 65cac9dbde..7c669ab457 100644
--- a/src/mesa/state_tracker/st_cb_clear.c
+++ b/src/mesa/state_tracker/st_cb_clear.c
@@ -370,7 +370,7 @@ clear_with_quad(GLcontext *ctx,
fs.inputs_read = tgsi_mesa_translate_fragment_input_mask(stfp->Base.Base.InputsRead);
fs.outputs_written = tgsi_mesa_translate_fragment_output_mask(stfp->Base.Base.OutputsWritten);
fs.tokens = &stfp->tokens[0];
- cached = st_cached_shader_state(st, &fs);
+ cached = st_cached_fs_state(st, &fs);
pipe->bind_fs_state(pipe, cached);
}
@@ -386,7 +386,7 @@ clear_with_quad(GLcontext *ctx,
vs.inputs_read = stvp->Base.Base.InputsRead;
vs.outputs_written = stvp->Base.Base.OutputsWritten;
vs.tokens = &stvp->tokens[0];
- cached = st_cached_shader_state(st, &vs);
+ cached = st_cached_vs_state(st, &vs);
pipe->bind_vs_state(pipe, cached);
}
diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c
index 731c060c11..67de781c83 100644
--- a/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -347,7 +347,7 @@ draw_textured_quad(GLcontext *ctx, GLint x, GLint y, GLfloat z,
memset(&fs, 0, sizeof(fs));
fs.inputs_read = stfp->Base.Base.InputsRead;
fs.tokens = &stfp->tokens[0];
- cached = st_cached_shader_state(ctx->st, &fs);
+ cached = st_cached_fs_state(ctx->st, &fs);
pipe->bind_fs_state(pipe, cached);
}
@@ -363,7 +363,7 @@ draw_textured_quad(GLcontext *ctx, GLint x, GLint y, GLfloat z,
vs.inputs_read = stvp->Base.Base.InputsRead;
vs.outputs_written = stvp->Base.Base.OutputsWritten;
vs.tokens = &stvp->tokens[0];
- cached = st_cached_shader_state(ctx->st, &vs);
+ cached = st_cached_vs_state(ctx->st, &vs);
pipe->bind_vs_state(pipe, cached);
}