summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/r600/r600_state_common.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2012-08-09 20:59:44 -0600
committerBrian Paul <[email protected]>2012-08-16 09:01:31 -0600
commitd663a557fd27d7c238248e19f22f2e6b05f03030 (patch)
tree7d993eb4423e62bd1469a14a87c5e39e4b28cda2 /src/gallium/drivers/r600/r600_state_common.c
parent10e552d056dd080c4e763a31df517c2d7684a9cf (diff)
r600: update sampler, sampler_view code for the future
For when we have pipe->set_sampler_states(pipe, shader, start, num, samplers), etc. Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/gallium/drivers/r600/r600_state_common.c')
-rw-r--r--src/gallium/drivers/r600/r600_state_common.c52
1 files changed, 43 insertions, 9 deletions
diff --git a/src/gallium/drivers/r600/r600_state_common.c b/src/gallium/drivers/r600/r600_state_common.c
index 393d81b7f3d..d8c5fb284ef 100644
--- a/src/gallium/drivers/r600/r600_state_common.c
+++ b/src/gallium/drivers/r600/r600_state_common.c
@@ -371,13 +371,30 @@ void r600_sampler_view_destroy(struct pipe_context *ctx,
FREE(resource);
}
-static void r600_bind_samplers(struct r600_context *rctx,
- struct r600_textures_info *dst,
+static void r600_bind_samplers(struct pipe_context *pipe,
+ unsigned shader,
+ unsigned start,
unsigned count, void **states)
{
+ struct r600_context *rctx = (struct r600_context *)pipe;
+ struct r600_textures_info *dst;
int seamless_cube_map = -1;
unsigned i;
+ assert(start == 0); /* XXX fix below */
+
+ switch (shader) {
+ case PIPE_SHADER_VERTEX:
+ dst = &rctx->vs_samplers;
+ break;
+ case PIPE_SHADER_FRAGMENT:
+ dst = &rctx->ps_samplers;
+ break;
+ default:
+ debug_error("bad shader in r600_bind_samplers()");
+ return;
+ }
+
memcpy(dst->samplers, states, sizeof(void*) * count);
dst->n_samplers = count;
dst->atom_sampler.num_dw = 0;
@@ -409,14 +426,12 @@ static void r600_bind_samplers(struct r600_context *rctx,
void r600_bind_vs_samplers(struct pipe_context *ctx, unsigned count, void **states)
{
- struct r600_context *rctx = (struct r600_context *)ctx;
- r600_bind_samplers(rctx, &rctx->vs_samplers, count, states);
+ r600_bind_samplers(ctx, PIPE_SHADER_VERTEX, 0, count, states);
}
void r600_bind_ps_samplers(struct pipe_context *ctx, unsigned count, void **states)
{
- struct r600_context *rctx = (struct r600_context *)ctx;
- r600_bind_samplers(rctx, &rctx->ps_samplers, count, states);
+ r600_bind_samplers(ctx, PIPE_SHADER_FRAGMENT, 0, count, states);
}
void r600_delete_sampler(struct pipe_context *ctx, void *state)
@@ -545,11 +560,14 @@ void r600_sampler_views_dirty(struct r600_context *rctx,
}
}
-void r600_set_sampler_views(struct r600_context *rctx,
- struct r600_textures_info *dst,
+void r600_set_sampler_views(struct pipe_context *pipe,
+ unsigned shader,
+ unsigned start,
unsigned count,
struct pipe_sampler_view **views)
{
+ struct r600_context *rctx = (struct r600_context *) pipe;
+ struct r600_textures_info *dst;
struct r600_pipe_sampler_view **rviews = (struct r600_pipe_sampler_view **)views;
unsigned i;
/* This sets 1-bit for textures with index >= count. */
@@ -558,7 +576,23 @@ void r600_set_sampler_views(struct r600_context *rctx,
uint32_t new_mask = 0;
/* Set textures with index >= count to NULL. */
- uint32_t remaining_mask = dst->views.enabled_mask & disable_mask;
+ uint32_t remaining_mask;
+
+ assert(start == 0); /* XXX fix below */
+
+ switch (shader) {
+ case PIPE_SHADER_VERTEX:
+ dst = &rctx->vs_samplers;
+ break;
+ case PIPE_SHADER_FRAGMENT:
+ dst = &rctx->ps_samplers;
+ break;
+ default:
+ debug_error("bad shader in r600_set_sampler_views()");
+ return;
+ }
+
+ remaining_mask = dst->views.enabled_mask & disable_mask;
while (remaining_mask) {
i = u_bit_scan(&remaining_mask);