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,
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,
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;
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)
}
}
-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. */
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);