summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/r600/evergreen_state.c6
-rw-r--r--src/gallium/drivers/r600/r600_pipe.h5
-rw-r--r--src/gallium/drivers/r600/r600_state.c6
-rw-r--r--src/gallium/drivers/r600/r600_state_common.c52
4 files changed, 50 insertions, 19 deletions
diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c
index 89f27b44497..c80e330a5b8 100644
--- a/src/gallium/drivers/r600/evergreen_state.c
+++ b/src/gallium/drivers/r600/evergreen_state.c
@@ -1123,15 +1123,13 @@ static struct pipe_sampler_view *evergreen_create_sampler_view(struct pipe_conte
static void evergreen_set_vs_sampler_views(struct pipe_context *ctx, unsigned count,
struct pipe_sampler_view **views)
{
- struct r600_context *rctx = (struct r600_context *)ctx;
- r600_set_sampler_views(rctx, &rctx->vs_samplers, count, views);
+ r600_set_sampler_views(ctx, PIPE_SHADER_VERTEX, 0, count, views);
}
static void evergreen_set_ps_sampler_views(struct pipe_context *ctx, unsigned count,
struct pipe_sampler_view **views)
{
- struct r600_context *rctx = (struct r600_context *)ctx;
- r600_set_sampler_views(rctx, &rctx->ps_samplers, count, views);
+ r600_set_sampler_views(ctx, PIPE_SHADER_FRAGMENT, 0, count, views);
}
static void evergreen_set_clip_state(struct pipe_context *ctx,
diff --git a/src/gallium/drivers/r600/r600_pipe.h b/src/gallium/drivers/r600/r600_pipe.h
index aeff52849ce..5d72952168e 100644
--- a/src/gallium/drivers/r600/r600_pipe.h
+++ b/src/gallium/drivers/r600/r600_pipe.h
@@ -568,8 +568,9 @@ void r600_set_vertex_buffers(struct pipe_context *ctx, unsigned count,
const struct pipe_vertex_buffer *input);
void r600_sampler_views_dirty(struct r600_context *rctx,
struct r600_samplerview_state *state);
-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);
void r600_bind_vs_samplers(struct pipe_context *ctx, unsigned count, void **states);
diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c
index b4f61a48a46..868455cba3b 100644
--- a/src/gallium/drivers/r600/r600_state.c
+++ b/src/gallium/drivers/r600/r600_state.c
@@ -1081,15 +1081,13 @@ static struct pipe_sampler_view *r600_create_sampler_view(struct pipe_context *c
static void r600_set_vs_sampler_views(struct pipe_context *ctx, unsigned count,
struct pipe_sampler_view **views)
{
- struct r600_context *rctx = (struct r600_context *)ctx;
- r600_set_sampler_views(rctx, &rctx->vs_samplers, count, views);
+ r600_set_sampler_views(ctx, PIPE_SHADER_VERTEX, 0, count, views);
}
static void r600_set_ps_sampler_views(struct pipe_context *ctx, unsigned count,
struct pipe_sampler_view **views)
{
- struct r600_context *rctx = (struct r600_context *)ctx;
- r600_set_sampler_views(rctx, &rctx->ps_samplers, count, views);
+ r600_set_sampler_views(ctx, PIPE_SHADER_FRAGMENT, 0, count, views);
}
static void r600_set_clip_state(struct pipe_context *ctx,
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);