From f22e920f478d8732695913ec0d1f7244b451a8f5 Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Wed, 19 Sep 2007 06:46:32 -0400 Subject: 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). --- src/mesa/pipe/cso_cache/cso_cache.c | 16 +++++++++++----- src/mesa/pipe/cso_cache/cso_cache.h | 6 ++++-- src/mesa/pipe/i915simple/i915_state.c | 6 ++++-- src/mesa/pipe/p_context.h | 11 ++++++++--- src/mesa/pipe/softpipe/sp_context.c | 10 ++++++---- 5 files changed, 33 insertions(+), 16 deletions(-) (limited to 'src/mesa/pipe') diff --git a/src/mesa/pipe/cso_cache/cso_cache.c b/src/mesa/pipe/cso_cache/cso_cache.c index be653d9494a..e87733c7aba 100644 --- a/src/mesa/pipe/cso_cache/cso_cache.c +++ b/src/mesa/pipe/cso_cache/cso_cache.c @@ -80,8 +80,10 @@ static struct cso_hash *_cso_hash_for_type(struct cso_cache *sc, enum cso_cache_ hash = sc->depth_stencil_hash; case CSO_RASTERIZER: hash = sc->rasterizer_hash; - case CSO_SHADER: - hash = sc->shader_hash; + case CSO_FRAGMENT_SHADER: + hash = sc->fs_hash; + case CSO_VERTEX_SHADER: + hash = sc->vs_hash; } return hash; @@ -98,7 +100,9 @@ static int _cso_size_for_type(enum cso_cache_type type) return sizeof(struct pipe_depth_stencil_state); case CSO_RASTERIZER: return sizeof(struct pipe_rasterizer_state); - case CSO_SHADER: + case CSO_FRAGMENT_SHADER: + return sizeof(struct pipe_shader_state); + case CSO_VERTEX_SHADER: return sizeof(struct pipe_shader_state); } return 0; @@ -152,7 +156,8 @@ struct cso_cache *cso_cache_create(void) sc->sampler_hash = cso_hash_create(); sc->depth_stencil_hash = cso_hash_create(); sc->rasterizer_hash = cso_hash_create(); - sc->shader_hash = cso_hash_create(); + sc->fs_hash = cso_hash_create(); + sc->vs_hash = cso_hash_create(); return sc; } @@ -164,6 +169,7 @@ void cso_cache_delete(struct cso_cache *sc) cso_hash_delete(sc->sampler_hash); cso_hash_delete(sc->depth_stencil_hash); cso_hash_delete(sc->rasterizer_hash); - cso_hash_delete(sc->shader_hash); + cso_hash_delete(sc->fs_hash); + cso_hash_delete(sc->vs_hash); free(sc); } diff --git a/src/mesa/pipe/cso_cache/cso_cache.h b/src/mesa/pipe/cso_cache/cso_cache.h index d9793ca8554..352e1a6a592 100644 --- a/src/mesa/pipe/cso_cache/cso_cache.h +++ b/src/mesa/pipe/cso_cache/cso_cache.h @@ -44,7 +44,8 @@ struct cso_cache { struct cso_hash *sampler_hash; struct cso_hash *depth_stencil_hash; struct cso_hash *rasterizer_hash; - struct cso_hash *shader_hash; + struct cso_hash *fs_hash; + struct cso_hash *vs_hash; }; enum cso_cache_type { @@ -52,7 +53,8 @@ enum cso_cache_type { CSO_SAMPLER, CSO_DEPTH_STENCIL, CSO_RASTERIZER, - CSO_SHADER + CSO_FRAGMENT_SHADER, + CSO_VERTEX_SHADER }; unsigned cso_construct_key(void *item, int item_size); diff --git a/src/mesa/pipe/i915simple/i915_state.c b/src/mesa/pipe/i915simple/i915_state.c index fe835643e06..aaf2ccf499c 100644 --- a/src/mesa/pipe/i915simple/i915_state.c +++ b/src/mesa/pipe/i915simple/i915_state.c @@ -373,10 +373,12 @@ i915_init_state_functions( struct i915_context *i915 ) i915->pipe.create_rasterizer_state = i915_create_rasterizer_state; i915->pipe.bind_rasterizer_state = i915_bind_rasterizer_state; i915->pipe.delete_rasterizer_state = i915_delete_rasterizer_state; - i915->pipe.create_shader_state = i915_create_shader_state; + i915->pipe.create_fs_state = i915_create_shader_state; i915->pipe.bind_fs_state = i915_bind_fs_state; + i915->pipe.delete_fs_state = i915_delete_shader_state; + i915->pipe.create_vs_state = i915_create_shader_state; i915->pipe.bind_vs_state = i915_bind_vs_state; - i915->pipe.delete_shader_state = i915_delete_shader_state; + i915->pipe.delete_vs_state = i915_delete_shader_state; i915->pipe.set_alpha_test_state = i915_set_alpha_test_state; i915->pipe.set_blend_color = i915_set_blend_color; diff --git a/src/mesa/pipe/p_context.h b/src/mesa/pipe/p_context.h index c405051bce4..5766b2b7df3 100644 --- a/src/mesa/pipe/p_context.h +++ b/src/mesa/pipe/p_context.h @@ -117,15 +117,20 @@ struct pipe_context { void (*delete_depth_stencil_state)(struct pipe_context *, const struct pipe_depth_stencil_state *); - const struct pipe_shader_state * (*create_shader_state)( + const struct pipe_shader_state * (*create_fs_state)( struct pipe_context *, const struct pipe_shader_state *); void (*bind_fs_state)(struct pipe_context *, const struct pipe_shader_state *); + void (*delete_fs_state)(struct pipe_context *, + const struct pipe_shader_state *); + const struct pipe_shader_state * (*create_vs_state)( + struct pipe_context *, + const struct pipe_shader_state *); void (*bind_vs_state)(struct pipe_context *, const struct pipe_shader_state *); - void (*delete_shader_state)(struct pipe_context *, - const struct pipe_shader_state *); + void (*delete_vs_state)(struct pipe_context *, + const struct pipe_shader_state *); void (*set_alpha_test_state)( struct pipe_context *, const struct pipe_alpha_test_state * ); diff --git a/src/mesa/pipe/softpipe/sp_context.c b/src/mesa/pipe/softpipe/sp_context.c index 25cb9d87450..a56793d6838 100644 --- a/src/mesa/pipe/softpipe/sp_context.c +++ b/src/mesa/pipe/softpipe/sp_context.c @@ -262,10 +262,12 @@ struct pipe_context *softpipe_create( struct pipe_winsys *pipe_winsys, softpipe->pipe.create_rasterizer_state = softpipe_create_rasterizer_state; softpipe->pipe.bind_rasterizer_state = softpipe_bind_rasterizer_state; softpipe->pipe.delete_rasterizer_state = softpipe_delete_rasterizer_state; - softpipe->pipe.create_shader_state = softpipe_create_shader_state; - softpipe->pipe.bind_fs_state = softpipe_bind_fs_state; - softpipe->pipe.bind_vs_state = softpipe_bind_vs_state; - softpipe->pipe.delete_shader_state = softpipe_delete_shader_state; + softpipe->pipe.create_fs_state = softpipe_create_shader_state; + softpipe->pipe.bind_fs_state = softpipe_bind_fs_state; + softpipe->pipe.delete_fs_state = softpipe_delete_shader_state; + softpipe->pipe.create_vs_state = softpipe_create_shader_state; + softpipe->pipe.bind_vs_state = softpipe_bind_vs_state; + softpipe->pipe.delete_vs_state = softpipe_delete_shader_state; softpipe->pipe.set_alpha_test_state = softpipe_set_alpha_test_state; softpipe->pipe.set_blend_color = softpipe_set_blend_color; -- cgit v1.2.3