aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/cso_cache
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2013-10-07 18:16:22 -0600
committerBrian Paul <[email protected]>2013-10-23 10:15:38 -0600
commita3ed98f7aa85636579a5696bf036ec13e5c9104a (patch)
tree104078a2a8b875e5ec7c5524e7797d46d109d7e0 /src/gallium/auxiliary/cso_cache
parentb11fc226e6b106de8eb777a8e62c4f7303c66fbc (diff)
gallium: new, unified pipe_context::set_sampler_views() function
The new function replaces four old functions: set_fragment/vertex/ geometry/compute_sampler_views(). Note: at this time, it's expected that the 'start' parameter will always be zero. Reviewed-by: Roland Scheidegger <[email protected]> Reviewed-by: Marek Olšák <[email protected]> Tested-by: Emil Velikov <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary/cso_cache')
-rw-r--r--src/gallium/auxiliary/cso_cache/cso_context.c35
1 files changed, 6 insertions, 29 deletions
diff --git a/src/gallium/auxiliary/cso_cache/cso_context.c b/src/gallium/auxiliary/cso_cache/cso_context.c
index 4d7c3871256..23d3245e881 100644
--- a/src/gallium/auxiliary/cso_cache/cso_context.c
+++ b/src/gallium/auxiliary/cso_cache/cso_context.c
@@ -306,6 +306,7 @@ void cso_release_all( struct cso_context *ctx )
ctx->pipe->bind_rasterizer_state( ctx->pipe, NULL );
{
+ static struct pipe_sampler_view *views[PIPE_MAX_SAMPLERS] = { NULL };
static void *zeros[PIPE_MAX_SAMPLERS] = { NULL };
struct pipe_screen *scr = ctx->pipe->screen;
unsigned sh;
@@ -315,6 +316,7 @@ void cso_release_all( struct cso_context *ctx )
assert(max <= PIPE_MAX_SAMPLERS);
if (max > 0) {
ctx->pipe->bind_sampler_states(ctx->pipe, sh, 0, max, zeros);
+ ctx->pipe->set_sampler_views(ctx->pipe, sh, 0, max, views);
}
}
}
@@ -323,9 +325,7 @@ void cso_release_all( struct cso_context *ctx )
ctx->pipe->bind_fs_state( ctx->pipe, NULL );
ctx->pipe->bind_vs_state( ctx->pipe, NULL );
ctx->pipe->bind_vertex_elements_state( ctx->pipe, NULL );
- ctx->pipe->set_fragment_sampler_views(ctx->pipe, 0, NULL);
- if (ctx->pipe->set_vertex_sampler_views)
- ctx->pipe->set_vertex_sampler_views(ctx->pipe, 0, NULL);
+
if (ctx->pipe->set_stream_output_targets)
ctx->pipe->set_stream_output_targets(ctx->pipe, 0, NULL, 0);
}
@@ -1185,19 +1185,8 @@ cso_set_sampler_views(struct cso_context *ctx,
info->nr_views = count;
/* bind the new sampler views */
- switch (shader_stage) {
- case PIPE_SHADER_FRAGMENT:
- ctx->pipe->set_fragment_sampler_views(ctx->pipe, count, info->views);
- break;
- case PIPE_SHADER_VERTEX:
- ctx->pipe->set_vertex_sampler_views(ctx->pipe, count, info->views);
- break;
- case PIPE_SHADER_GEOMETRY:
- ctx->pipe->set_geometry_sampler_views(ctx->pipe, count, info->views);
- break;
- default:
- assert(!"bad shader type in cso_set_sampler_views()");
- }
+ ctx->pipe->set_sampler_views(ctx->pipe, shader_stage, 0, count,
+ info->views);
}
@@ -1236,19 +1225,7 @@ cso_restore_sampler_views(struct cso_context *ctx, unsigned shader_stage)
num = MAX2(info->nr_views, nr_saved);
/* bind the old/saved sampler views */
- switch (shader_stage) {
- case PIPE_SHADER_FRAGMENT:
- ctx->pipe->set_fragment_sampler_views(ctx->pipe, num, info->views);
- break;
- case PIPE_SHADER_VERTEX:
- ctx->pipe->set_vertex_sampler_views(ctx->pipe, num, info->views);
- break;
- case PIPE_SHADER_GEOMETRY:
- ctx->pipe->set_geometry_sampler_views(ctx->pipe, num, info->views);
- break;
- default:
- assert(!"bad shader type in cso_restore_sampler_views()");
- }
+ ctx->pipe->set_sampler_views(ctx->pipe, shader_stage, 0, num, info->views);
info->nr_views = nr_saved;
info->nr_views_saved = 0;