summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2013-09-12 15:09:01 -0600
committerBrian Paul <brianp@vmware.com>2013-09-12 18:07:52 -0600
commit2b8dc3cc8f16baf709530db19fbadb3bce687937 (patch)
tree41415fba2b6f0ff4f44812141ab68254916c8457
parent28c72d4c920392ddc71513ce328d64eed192ee49 (diff)
radeon: implement pipe_context::bind_sampler_states()
-rw-r--r--src/gallium/drivers/r300/r300_state.c26
-rw-r--r--src/gallium/drivers/r600/r600_state_common.c1
-rw-r--r--src/gallium/drivers/radeonsi/si_state.c22
3 files changed, 49 insertions, 0 deletions
diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c
index 249ee8beed..e10ea164f9 100644
--- a/src/gallium/drivers/r300/r300_state.c
+++ b/src/gallium/drivers/r300/r300_state.c
@@ -1541,6 +1541,31 @@ static void r300_bind_fragment_sampler_states(struct pipe_context* pipe,
r300_mark_atom_dirty(r300, &r300->textures_state);
}
+static void r300_bind_sampler_states(struct pipe_context* pipe,
+ unsigned shader,
+ unsigned start, unsigned count,
+ void** states)
+{
+ struct r300_context* r300 = r300_context(pipe);
+ struct r300_textures_state* state =
+ (struct r300_textures_state*)r300->textures_state.state;
+ unsigned tex_units = r300->screen->caps.num_tex_units;
+
+ assert(start == 0);
+
+ if (shader != PIPE_SHADER_FRAGMENT)
+ return;
+
+ if (count > tex_units)
+ return;
+
+ memcpy(state->sampler_states, states, sizeof(void*) * count);
+ state->sampler_state_count = count;
+
+ r300_mark_atom_dirty(r300, &r300->textures_state);
+}
+
+
static void r300_lacks_vertex_textures(struct pipe_context* pipe,
unsigned count,
void** states)
@@ -2157,6 +2182,7 @@ void r300_init_state_functions(struct r300_context* r300)
r300->context.delete_rasterizer_state = r300_delete_rs_state;
r300->context.create_sampler_state = r300_create_sampler_state;
+ r300->context.bind_sampler_states = r300_bind_sampler_states;
r300->context.bind_fragment_sampler_states = r300_bind_fragment_sampler_states;
r300->context.bind_vertex_sampler_states = r300_lacks_vertex_textures;
r300->context.delete_sampler_state = r300_delete_sampler_state;
diff --git a/src/gallium/drivers/r600/r600_state_common.c b/src/gallium/drivers/r600/r600_state_common.c
index 31d08a877e..b22a201b99 100644
--- a/src/gallium/drivers/r600/r600_state_common.c
+++ b/src/gallium/drivers/r600/r600_state_common.c
@@ -1636,6 +1636,7 @@ void r600_init_common_state_functions(struct r600_context *rctx)
rctx->b.b.create_vertex_elements_state = r600_create_vertex_fetch_shader;
rctx->b.b.bind_blend_state = r600_bind_blend_state;
rctx->b.b.bind_depth_stencil_alpha_state = r600_bind_dsa_state;
+ rctx->b.b.bind_sampler_states = r600_bind_sampler_states;
rctx->b.b.bind_fragment_sampler_states = r600_bind_ps_sampler_states;
rctx->b.b.bind_fs_state = r600_bind_ps_state;
rctx->b.b.bind_rasterizer_state = r600_bind_rs_state;
diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c
index e1b4e32b6d..d29167d218 100644
--- a/src/gallium/drivers/radeonsi/si_state.c
+++ b/src/gallium/drivers/radeonsi/si_state.c
@@ -3003,6 +3003,27 @@ static void si_bind_ps_sampler_states(struct pipe_context *ctx, unsigned count,
si_pm4_set_state(rctx, ps_sampler, pm4);
}
+
+static void si_bind_sampler_states(struct pipe_context *ctx, unsigned shader,
+ unsigned start, unsigned count,
+ void **states)
+{
+ assert(start == 0);
+
+ switch (shader) {
+ case PIPE_SHADER_VERTEX:
+ si_bind_vs_sampler_states(ctx, count, states);
+ break;
+ case PIPE_SHADER_FRAGMENT:
+ si_bind_ps_sampler_states(ctx, count, states);
+ break;
+ default:
+ ;
+ }
+}
+
+
+
static void si_set_sample_mask(struct pipe_context *ctx, unsigned sample_mask)
{
struct r600_context *rctx = (struct r600_context *)ctx;
@@ -3192,6 +3213,7 @@ void si_init_state_functions(struct r600_context *rctx)
rctx->b.b.delete_fs_state = si_delete_ps_shader;
rctx->b.b.create_sampler_state = si_create_sampler_state;
+ rctx->b.b.bind_sampler_states = si_bind_sampler_states;
rctx->b.b.bind_vertex_sampler_states = si_bind_vs_sampler_states;
rctx->b.b.bind_fragment_sampler_states = si_bind_ps_sampler_states;
rctx->b.b.delete_sampler_state = si_delete_sampler_state;