diff options
author | Zack Rusin <[email protected]> | 2007-09-19 06:46:32 -0400 |
---|---|---|
committer | Zack Rusin <[email protected]> | 2007-09-19 06:46:32 -0400 |
commit | f22e920f478d8732695913ec0d1f7244b451a8f5 (patch) | |
tree | 8244f28277fe213c2860c71c1dc368d34a5050a5 /src/mesa/state_tracker | |
parent | bb611c5f1f6aec7ac51d4fa3301422b47f6de795 (diff) |
Finish up conversions of shaders to immutable objects.
Create/Delete calls should be split since in create we'll be
compiling them so we want to know which one it is (vertex/fragment).
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r-- | src/mesa/state_tracker/st_atom_fs.c | 2 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_atom_vs.c | 2 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_cache.c | 26 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_cache.h | 7 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_cb_clear.c | 4 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_cb_drawpixels.c | 4 |
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 3df2c6750ab..6dd576a57cb 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 8de19e41eeb..166dc70b083 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 7b851e3901b..d84a396e183 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 6a897a99933..bcbe19b8236 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 65cac9dbde8..7c669ab4578 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 731c060c11d..67de781c831 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); } |