diff options
author | Brian Paul <[email protected]> | 2012-08-02 13:02:40 -0600 |
---|---|---|
committer | Brian Paul <[email protected]> | 2012-08-03 07:16:35 -0600 |
commit | ea6f035ae90895bd4ee3247408eb179dfdf96d22 (patch) | |
tree | 19df9d3c7b12cb641cea4ccb84950c09992c1732 /src/gallium/auxiliary/cso_cache/cso_context.h | |
parent | 350f12fb657a2ac860796c179233fa357e4bf46c (diff) |
gallium: consolidate CSO sampler and sampler_view functions
Merge the vertex/fragment versions of the cso_set/save/restore_samplers()
functions. Now we pass the shader stage (PIPE_SHADER_x) to the function
to indicate vertex/fragment/geometry samplers. For example:
cso_single_sampler(cso, PIPE_SHADER_FRAGMENT, unit, sampler);
This results in quite a bit of code reduction, fewer CSO functions and
support for geometry shaders.
Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary/cso_cache/cso_context.h')
-rw-r--r-- | src/gallium/auxiliary/cso_cache/cso_context.h | 79 |
1 files changed, 29 insertions, 50 deletions
diff --git a/src/gallium/auxiliary/cso_cache/cso_context.h b/src/gallium/auxiliary/cso_cache/cso_context.h index 4de08a8364c..f01a0f20c62 100644 --- a/src/gallium/auxiliary/cso_cache/cso_context.h +++ b/src/gallium/auxiliary/cso_cache/cso_context.h @@ -69,39 +69,29 @@ void cso_save_rasterizer(struct cso_context *cso); void cso_restore_rasterizer(struct cso_context *cso); - -enum pipe_error cso_set_samplers( struct cso_context *cso, - unsigned count, - const struct pipe_sampler_state **states ); -void cso_save_samplers(struct cso_context *cso); -void cso_restore_samplers(struct cso_context *cso); - -/* Alternate interface to support state trackers that like to modify - * samplers one at a time: - */ -enum pipe_error cso_single_sampler( struct cso_context *cso, - unsigned nr, - const struct pipe_sampler_state *states ); - -void cso_single_sampler_done( struct cso_context *cso ); - -enum pipe_error cso_set_vertex_samplers(struct cso_context *cso, - unsigned count, - const struct pipe_sampler_state **states); +enum pipe_error +cso_set_samplers(struct cso_context *cso, + unsigned shader_stage, + unsigned count, + const struct pipe_sampler_state **states); void -cso_save_vertex_samplers(struct cso_context *cso); +cso_save_samplers(struct cso_context *cso, unsigned shader_stage); void -cso_restore_vertex_samplers(struct cso_context *cso); +cso_restore_samplers(struct cso_context *cso, unsigned shader_stage); +/* Alternate interface to support state trackers that like to modify + * samplers one at a time: + */ enum pipe_error -cso_single_vertex_sampler(struct cso_context *cso, - unsigned nr, - const struct pipe_sampler_state *states); +cso_single_sampler(struct cso_context *cso, + unsigned shader_stage, + unsigned count, + const struct pipe_sampler_state *states); void -cso_single_vertex_sampler_done(struct cso_context *cso); +cso_single_sampler_done(struct cso_context *cso, unsigned shader_stage); enum pipe_error cso_set_vertex_elements(struct cso_context *ctx, @@ -126,6 +116,13 @@ void cso_save_stream_outputs(struct cso_context *ctx); void cso_restore_stream_outputs(struct cso_context *ctx); +/* + * We don't provide shader caching in CSO. Most of the time the api provides + * object semantics for shaders anyway, and the cases where it doesn't + * (eg mesa's internally-generated texenv programs), it will be up to + * the state tracker to implement their own specialized caching. + */ + enum pipe_error cso_set_fragment_shader_handle(struct cso_context *ctx, void *handle ); void cso_delete_fragment_shader(struct cso_context *ctx, void *handle ); @@ -184,39 +181,21 @@ void cso_restore_clip(struct cso_context *cso); -/* fragment sampler view state */ - -/* - * We don't provide shader caching in CSO. Most of the time the api provides - * object semantics for shaders anyway, and the cases where it doesn't - * (eg mesa's internally-generated texenv programs), it will be up to - * the state tracker to implement their own specialized caching. - */ - -void -cso_set_fragment_sampler_views(struct cso_context *cso, - uint count, - struct pipe_sampler_view **views); +/* sampler view state */ void -cso_save_fragment_sampler_views(struct cso_context *cso); +cso_set_sampler_views(struct cso_context *cso, + unsigned shader_stage, + unsigned count, + struct pipe_sampler_view **views); void -cso_restore_fragment_sampler_views(struct cso_context *cso); - - -/* vertex sampler view state */ +cso_save_sampler_views(struct cso_context *cso, unsigned shader_stage); void -cso_set_vertex_sampler_views(struct cso_context *cso, - uint count, - struct pipe_sampler_view **views); +cso_restore_sampler_views(struct cso_context *cso, unsigned shader_stage); -void -cso_save_vertex_sampler_views(struct cso_context *cso); -void -cso_restore_vertex_sampler_views(struct cso_context *cso); /* drawing */ |