diff options
76 files changed, 201 insertions, 101 deletions
diff --git a/src/gallium/auxiliary/cso_cache/cso_context.c b/src/gallium/auxiliary/cso_cache/cso_context.c index 5ba9d59a27b..eaf1b61f86f 100644 --- a/src/gallium/auxiliary/cso_cache/cso_context.c +++ b/src/gallium/auxiliary/cso_cache/cso_context.c @@ -337,7 +337,7 @@ void cso_destroy_context( struct cso_context *ctx ) ctx->pipe->bind_sampler_states(ctx->pipe, sh, 0, maxsam, zeros); } if (maxview > 0) { - ctx->pipe->set_sampler_views(ctx->pipe, sh, 0, maxview, views); + ctx->pipe->set_sampler_views(ctx->pipe, sh, 0, maxview, 0, views); } if (maxssbo > 0) { ctx->pipe->set_shader_buffers(ctx->pipe, sh, 0, maxssbo, ssbos, 0); diff --git a/src/gallium/auxiliary/draw/draw_pipe_pstipple.c b/src/gallium/auxiliary/draw/draw_pipe_pstipple.c index dbb0545a9ac..64776534db1 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_pstipple.c +++ b/src/gallium/auxiliary/draw/draw_pipe_pstipple.c @@ -108,6 +108,7 @@ struct pstip_stage void (*driver_set_sampler_views)(struct pipe_context *, enum pipe_shader_type shader, unsigned start, unsigned count, + unsigned unbind_num_trailing_slots, struct pipe_sampler_view **); void (*driver_set_polygon_stipple)(struct pipe_context *, @@ -225,7 +226,7 @@ pstip_first_tri(struct draw_stage *stage, struct prim_header *header) num_samplers, pstip->state.samplers); pstip->driver_set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, - num_sampler_views, pstip->state.sampler_views); + num_sampler_views, 0, pstip->state.sampler_views); draw->suspend_flushing = FALSE; @@ -254,7 +255,7 @@ pstip_flush(struct draw_stage *stage, unsigned flags) pstip->state.samplers); pstip->driver_set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, - pstip->num_sampler_views, + pstip->num_sampler_views, 0, pstip->state.sampler_views); draw->suspend_flushing = FALSE; @@ -418,6 +419,7 @@ static void pstip_set_sampler_views(struct pipe_context *pipe, enum pipe_shader_type shader, unsigned start, unsigned num, + unsigned unbind_num_trailing_slots, struct pipe_sampler_view **views) { struct pstip_stage *pstip = pstip_stage_from_pipe(pipe); @@ -429,11 +431,16 @@ pstip_set_sampler_views(struct pipe_context *pipe, pipe_sampler_view_reference(&pstip->state.sampler_views[start + i], views[i]); } + for (; i < num + unbind_num_trailing_slots; i++) { + pipe_sampler_view_reference(&pstip->state.sampler_views[start + i], + NULL); + } pstip->num_sampler_views = num; } /* pass-through */ - pstip->driver_set_sampler_views(pstip->pipe, shader, start, num, views); + pstip->driver_set_sampler_views(pstip->pipe, shader, start, num, + unbind_num_trailing_slots, views); } diff --git a/src/gallium/auxiliary/driver_ddebug/dd_context.c b/src/gallium/auxiliary/driver_ddebug/dd_context.c index 211133fd7e8..69117f0e12b 100644 --- a/src/gallium/auxiliary/driver_ddebug/dd_context.c +++ b/src/gallium/auxiliary/driver_ddebug/dd_context.c @@ -510,6 +510,7 @@ static void dd_context_set_sampler_views(struct pipe_context *_pipe, enum pipe_shader_type shader, unsigned start, unsigned num, + unsigned unbind_num_trailing_slots, struct pipe_sampler_view **views) { struct dd_context *dctx = dd_context(_pipe); @@ -517,7 +518,10 @@ dd_context_set_sampler_views(struct pipe_context *_pipe, safe_memcpy(&dctx->draw_state.sampler_views[shader][start], views, sizeof(views[0]) * num); - pipe->set_sampler_views(pipe, shader, start, num, views); + safe_memcpy(&dctx->draw_state.sampler_views[shader][start + num], views, + sizeof(views[0]) * unbind_num_trailing_slots); + pipe->set_sampler_views(pipe, shader, start, num, + unbind_num_trailing_slots, views); } static void diff --git a/src/gallium/auxiliary/driver_noop/noop_state.c b/src/gallium/auxiliary/driver_noop/noop_state.c index b0315afe1e0..b7031c33cf9 100644 --- a/src/gallium/auxiliary/driver_noop/noop_state.c +++ b/src/gallium/auxiliary/driver_noop/noop_state.c @@ -114,6 +114,7 @@ static struct pipe_surface *noop_create_surface(struct pipe_context *ctx, static void noop_set_sampler_views(struct pipe_context *ctx, enum pipe_shader_type shader, unsigned start, unsigned count, + unsigned unbind_num_trailing_slots, struct pipe_sampler_view **views) { } diff --git a/src/gallium/auxiliary/driver_rbug/rbug_context.c b/src/gallium/auxiliary/driver_rbug/rbug_context.c index e0d92ff8021..225c77ecec1 100644 --- a/src/gallium/auxiliary/driver_rbug/rbug_context.c +++ b/src/gallium/auxiliary/driver_rbug/rbug_context.c @@ -738,6 +738,7 @@ rbug_set_sampler_views(struct pipe_context *_pipe, enum pipe_shader_type shader, unsigned start, unsigned num, + unsigned unbind_num_trailing_slots, struct pipe_sampler_view **_views) { struct rbug_context *rb_pipe = rbug_context(_pipe); @@ -766,7 +767,8 @@ rbug_set_sampler_views(struct pipe_context *_pipe, views = unwrapped_views; } - pipe->set_sampler_views(pipe, shader, start, num, views); + pipe->set_sampler_views(pipe, shader, start, num, + unbind_num_trailing_slots, views); mtx_unlock(&rb_pipe->call_mutex); } diff --git a/src/gallium/auxiliary/driver_trace/tr_context.c b/src/gallium/auxiliary/driver_trace/tr_context.c index 3b81b70289e..9022597a2dd 100644 --- a/src/gallium/auxiliary/driver_trace/tr_context.c +++ b/src/gallium/auxiliary/driver_trace/tr_context.c @@ -987,6 +987,7 @@ trace_context_set_sampler_views(struct pipe_context *_pipe, enum pipe_shader_type shader, unsigned start, unsigned num, + unsigned unbind_num_trailing_slots, struct pipe_sampler_view **views) { struct trace_context *tr_ctx = trace_context(_pipe); @@ -1010,9 +1011,11 @@ trace_context_set_sampler_views(struct pipe_context *_pipe, trace_dump_arg(uint, shader); trace_dump_arg(uint, start); trace_dump_arg(uint, num); + trace_dump_arg(uint, unbind_num_trailing_slots); trace_dump_arg_array(ptr, views, num); - pipe->set_sampler_views(pipe, shader, start, num, views); + pipe->set_sampler_views(pipe, shader, start, num, + unbind_num_trailing_slots, views); trace_dump_call_end(); } diff --git a/src/gallium/auxiliary/hud/hud_context.c b/src/gallium/auxiliary/hud/hud_context.c index 8c2146b8a50..487c9fe73e1 100644 --- a/src/gallium/auxiliary/hud/hud_context.c +++ b/src/gallium/auxiliary/hud/hud_context.c @@ -537,7 +537,7 @@ hud_draw_results(struct hud_context *hud, struct pipe_resource *tex) cso_set_vertex_shader_handle(cso, hud->vs); cso_set_vertex_elements(cso, &hud->velems); cso_set_render_condition(cso, NULL, FALSE, 0); - pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, 1, + pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, 1, 0, &hud->font_sampler_view); cso_set_samplers(cso, PIPE_SHADER_FRAGMENT, 1, sampler_states); pipe->set_constant_buffer(pipe, PIPE_SHADER_VERTEX, 0, false, &hud->constbuf); @@ -608,7 +608,7 @@ done: /* Unbind resources that we have bound. */ pipe->set_constant_buffer(pipe, PIPE_SHADER_VERTEX, 0, false, NULL); pipe->set_vertex_buffers(pipe, 0, 0, 1, NULL); - pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, 1, NULL); + pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, 0, 1, NULL); /* restore states not restored by cso */ if (hud->st) { diff --git a/src/gallium/auxiliary/postprocess/pp_colors.c b/src/gallium/auxiliary/postprocess/pp_colors.c index 42403642982..f319ebb2219 100644 --- a/src/gallium/auxiliary/postprocess/pp_colors.c +++ b/src/gallium/auxiliary/postprocess/pp_colors.c @@ -47,7 +47,7 @@ pp_nocolor(struct pp_queue_t *ppq, struct pipe_resource *in, pp_filter_misc_state(p); cso_set_samplers(p->cso, PIPE_SHADER_FRAGMENT, 1, samplers); - pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, 1, &p->view); + pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, 1, 0, &p->view); cso_set_vertex_shader_handle(p->cso, ppq->shaders[n][0]); cso_set_fragment_shader_handle(p->cso, ppq->shaders[n][1]); diff --git a/src/gallium/auxiliary/postprocess/pp_mlaa.c b/src/gallium/auxiliary/postprocess/pp_mlaa.c index d37c69e5f1b..2bc2ac873df 100644 --- a/src/gallium/auxiliary/postprocess/pp_mlaa.c +++ b/src/gallium/auxiliary/postprocess/pp_mlaa.c @@ -134,7 +134,7 @@ pp_jimenezmlaa_run(struct pp_queue_t *ppq, struct pipe_resource *in, const struct pipe_sampler_state *samplers[] = {&p->sampler_point}; cso_set_samplers(p->cso, PIPE_SHADER_FRAGMENT, 1, samplers); } - pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, 1, &p->view); + pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, 1, 0, &p->view); cso_set_vertex_shader_handle(p->cso, ppq->shaders[n][1]); /* offsetvs */ cso_set_fragment_shader_handle(p->cso, ppq->shaders[n][2]); @@ -166,7 +166,7 @@ pp_jimenezmlaa_run(struct pp_queue_t *ppq, struct pipe_resource *in, } arr[0] = p->view; - pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, 3, arr); + pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, 3, 0, arr); cso_set_vertex_shader_handle(p->cso, ppq->shaders[n][0]); /* passvs */ cso_set_fragment_shader_handle(p->cso, ppq->shaders[n][3]); @@ -198,7 +198,7 @@ pp_jimenezmlaa_run(struct pp_queue_t *ppq, struct pipe_resource *in, } arr[1] = p->view; - pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, 2, arr); + pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, 2, 0, arr); cso_set_vertex_shader_handle(p->cso, ppq->shaders[n][1]); /* offsetvs */ cso_set_fragment_shader_handle(p->cso, ppq->shaders[n][4]); diff --git a/src/gallium/auxiliary/postprocess/pp_run.c b/src/gallium/auxiliary/postprocess/pp_run.c index 882450705d4..b0be81c3318 100644 --- a/src/gallium/auxiliary/postprocess/pp_run.c +++ b/src/gallium/auxiliary/postprocess/pp_run.c @@ -191,7 +191,7 @@ pp_run(struct pp_queue_t *ppq, struct pipe_resource *in, pipe->set_constant_buffer(pipe, PIPE_SHADER_VERTEX, 0, false, NULL); pipe->set_constant_buffer(pipe, PIPE_SHADER_FRAGMENT, 0, false, NULL); pipe->set_vertex_buffers(pipe, 0, 0, 1, NULL); - pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, 3, NULL); + pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, 0, 3, NULL); /* restore states not restored by cso */ if (ppq->p->st) { diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c index 3d11bfe28c7..eb28504dc5c 100644 --- a/src/gallium/auxiliary/util/u_blitter.c +++ b/src/gallium/auxiliary/util/u_blitter.c @@ -784,7 +784,7 @@ void util_blitter_restore_textures(struct blitter_context *blitter) /* Fragment sampler views. */ pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, - ctx->base.saved_num_sampler_views, + ctx->base.saved_num_sampler_views, 0, ctx->base.saved_sampler_views); for (i = 0; i < ctx->base.saved_num_sampler_views; i++) @@ -2082,7 +2082,7 @@ void util_blitter_blit_generic(struct blitter_context *blitter, views[0] = src; views[1] = pipe->create_sampler_view(pipe, src->texture, &templ); - pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, 2, views); + pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, 2, 0, views); pipe->bind_sampler_states(pipe, PIPE_SHADER_FRAGMENT, 0, 2, samplers); pipe_sampler_view_reference(&views[1], NULL); @@ -2097,13 +2097,13 @@ void util_blitter_blit_generic(struct blitter_context *blitter, view = pipe->create_sampler_view(pipe, src->texture, &templ); - pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, 1, &view); + pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, 1, 0, &view); pipe->bind_sampler_states(pipe, PIPE_SHADER_FRAGMENT, 0, 1, &sampler_state); pipe_sampler_view_reference(&view, NULL); } else { - pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, 1, &src); + pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, 1, 0, &src); pipe->bind_sampler_states(pipe, PIPE_SHADER_FRAGMENT, 0, 1, &sampler_state); } @@ -2250,7 +2250,7 @@ void util_blitter_generate_mipmap(struct blitter_context *blitter, src_templ.format = format; src_view = pipe->create_sampler_view(pipe, tex, &src_templ); - pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, 1, &src_view); + pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, 1, 0, &src_view); do_blits(ctx, dst_view, &dstbox, src_view, tex->width0, tex->height0, &srcbox, is_depth, false); @@ -2884,7 +2884,7 @@ util_blitter_stencil_fallback(struct blitter_context *blitter, true); } - pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, 1, &src_view); + pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, 1, 0, &src_view); pipe->bind_sampler_states(pipe, PIPE_SHADER_FRAGMENT, 0, 1, &ctx->sampler_state); unsigned stencil_bits = diff --git a/src/gallium/auxiliary/util/u_compute.c b/src/gallium/auxiliary/util/u_compute.c index dcfc266f8c2..79755abaf1d 100644 --- a/src/gallium/auxiliary/util/u_compute.c +++ b/src/gallium/auxiliary/util/u_compute.c @@ -138,7 +138,7 @@ void util_compute_blit(struct pipe_context *ctx, struct pipe_blit_info *blit_inf u_sampler_view_default_template(&src_templ, src, src->format); src_templ.format = util_format_linear(blit_info->src.format); src_view = ctx->create_sampler_view(ctx, src, &src_templ); - ctx->set_sampler_views(ctx, PIPE_SHADER_COMPUTE, 0, 1, &src_view); + ctx->set_sampler_views(ctx, PIPE_SHADER_COMPUTE, 0, 1, 0, &src_view); if (!*compute_state) *compute_state = blit_compute_shader(ctx); @@ -159,7 +159,7 @@ void util_compute_blit(struct pipe_context *ctx, struct pipe_blit_info *blit_inf ctx->set_shader_images(ctx, PIPE_SHADER_COMPUTE, 0, 0, 1, NULL); ctx->set_constant_buffer(ctx, PIPE_SHADER_COMPUTE, 0, false, NULL); - ctx->set_sampler_views(ctx, PIPE_SHADER_COMPUTE, 0, 1, NULL); + ctx->set_sampler_views(ctx, PIPE_SHADER_COMPUTE, 0, 0, 1, NULL); pipe_sampler_view_reference(&src_view, NULL); ctx->delete_sampler_state(ctx, sampler_state_p); ctx->bind_compute_state(ctx, NULL); diff --git a/src/gallium/auxiliary/util/u_tests.c b/src/gallium/auxiliary/util/u_tests.c index f73123b8ef2..47f479c435a 100644 --- a/src/gallium/auxiliary/util/u_tests.c +++ b/src/gallium/auxiliary/util/u_tests.c @@ -388,7 +388,7 @@ null_sampler_view(struct pipe_context *ctx, unsigned tgsi_tex_target) PIPE_FORMAT_R8G8B8A8_UNORM, 0); util_set_common_states_and_clear(cso, ctx, cb); - ctx->set_sampler_views(ctx, PIPE_SHADER_FRAGMENT, 0, 1, NULL); + ctx->set_sampler_views(ctx, PIPE_SHADER_FRAGMENT, 0, 0, 1, NULL); /* Fragment shader. */ fs = util_make_fragment_tex_shader(ctx, tgsi_tex_target, @@ -698,7 +698,7 @@ test_texture_barrier(struct pipe_context *ctx, bool use_fbfetch, templ.swizzle_b = PIPE_SWIZZLE_Z; templ.swizzle_a = PIPE_SWIZZLE_W; view = ctx->create_sampler_view(ctx, cb, &templ); - ctx->set_sampler_views(ctx, PIPE_SHADER_FRAGMENT, 0, 1, &view); + ctx->set_sampler_views(ctx, PIPE_SHADER_FRAGMENT, 0, 1, 0, &view); /* Fragment shader. */ if (num_samples > 1) { diff --git a/src/gallium/auxiliary/util/u_threaded_context.c b/src/gallium/auxiliary/util/u_threaded_context.c index 9c078886b20..f5c4b01618b 100644 --- a/src/gallium/auxiliary/util/u_threaded_context.c +++ b/src/gallium/auxiliary/util/u_threaded_context.c @@ -941,7 +941,7 @@ tc_set_window_rectangles(struct pipe_context *_pipe, bool include, } struct tc_sampler_views { - ubyte shader, start, count; + ubyte shader, start, count, unbind_num_trailing_slots; struct pipe_sampler_view *slot[0]; /* more will be allocated if needed */ }; @@ -951,7 +951,8 @@ tc_call_set_sampler_views(struct pipe_context *pipe, union tc_payload *payload) struct tc_sampler_views *p = (struct tc_sampler_views *)payload; unsigned count = p->count; - pipe->set_sampler_views(pipe, p->shader, p->start, p->count, p->slot); + pipe->set_sampler_views(pipe, p->shader, p->start, p->count, + p->unbind_num_trailing_slots, p->slot); for (unsigned i = 0; i < count; i++) pipe_sampler_view_reference(&p->slot[i], NULL); } @@ -960,9 +961,10 @@ static void tc_set_sampler_views(struct pipe_context *_pipe, enum pipe_shader_type shader, unsigned start, unsigned count, + unsigned unbind_num_trailing_slots, struct pipe_sampler_view **views) { - if (!count) + if (!count && !unbind_num_trailing_slots) return; struct threaded_context *tc = threaded_context(_pipe); @@ -972,6 +974,7 @@ tc_set_sampler_views(struct pipe_context *_pipe, p->shader = shader; p->start = start; p->count = count; + p->unbind_num_trailing_slots = unbind_num_trailing_slots; if (views) { for (unsigned i = 0; i < count; i++) { diff --git a/src/gallium/auxiliary/vl/vl_bicubic_filter.c b/src/gallium/auxiliary/vl/vl_bicubic_filter.c index d6e128a4440..3058d9f4381 100644 --- a/src/gallium/auxiliary/vl/vl_bicubic_filter.c +++ b/src/gallium/auxiliary/vl/vl_bicubic_filter.c @@ -452,7 +452,7 @@ vl_bicubic_filter_render(struct vl_bicubic_filter *filter, filter->pipe->bind_sampler_states(filter->pipe, PIPE_SHADER_FRAGMENT, 0, 1, &filter->sampler); filter->pipe->set_sampler_views(filter->pipe, PIPE_SHADER_FRAGMENT, - 0, 1, &src); + 0, 1, 0, &src); filter->pipe->bind_vs_state(filter->pipe, filter->vs); filter->pipe->bind_fs_state(filter->pipe, filter->fs); filter->pipe->set_framebuffer_state(filter->pipe, &fb_state); diff --git a/src/gallium/auxiliary/vl/vl_compositor_cs.c b/src/gallium/auxiliary/vl/vl_compositor_cs.c index c8a375cb9fd..813aa148918 100644 --- a/src/gallium/auxiliary/vl/vl_compositor_cs.c +++ b/src/gallium/auxiliary/vl/vl_compositor_cs.c @@ -727,14 +727,14 @@ draw_layers(struct vl_compositor *c, c->pipe->bind_sampler_states(c->pipe, PIPE_SHADER_COMPUTE, 0, num_sampler_views, layer->samplers); c->pipe->set_sampler_views(c->pipe, PIPE_SHADER_COMPUTE, 0, - num_sampler_views, samplers); + num_sampler_views, 0, samplers); cs_launch(c, layer->cs, &(drawn.area)); /* Unbind. */ c->pipe->set_shader_images(c->pipe, PIPE_SHADER_COMPUTE, 0, 0, 1, NULL); c->pipe->set_constant_buffer(c->pipe, PIPE_SHADER_COMPUTE, 0, false, NULL); - c->pipe->set_sampler_views(c->pipe, PIPE_SHADER_FRAGMENT, 0, + c->pipe->set_sampler_views(c->pipe, PIPE_SHADER_FRAGMENT, 0, 0, num_sampler_views, NULL); c->pipe->bind_compute_state(c->pipe, NULL); c->pipe->bind_sampler_states(c->pipe, PIPE_SHADER_COMPUTE, 0, diff --git a/src/gallium/auxiliary/vl/vl_compositor_gfx.c b/src/gallium/auxiliary/vl/vl_compositor_gfx.c index b1a6d2027b1..344de4ef529 100644 --- a/src/gallium/auxiliary/vl/vl_compositor_gfx.c +++ b/src/gallium/auxiliary/vl/vl_compositor_gfx.c @@ -665,7 +665,7 @@ draw_layers(struct vl_compositor *c, struct vl_compositor_state *s, struct u_rec c->pipe->bind_sampler_states(c->pipe, PIPE_SHADER_FRAGMENT, 0, num_sampler_views, layer->samplers); c->pipe->set_sampler_views(c->pipe, PIPE_SHADER_FRAGMENT, 0, - num_sampler_views, samplers); + num_sampler_views, 0, samplers); util_draw_arrays(c->pipe, PIPE_PRIM_QUADS, vb_index * 4, 4); vb_index++; diff --git a/src/gallium/auxiliary/vl/vl_deint_filter.c b/src/gallium/auxiliary/vl/vl_deint_filter.c index 3754e00370c..d840c9dcc3a 100644 --- a/src/gallium/auxiliary/vl/vl_deint_filter.c +++ b/src/gallium/auxiliary/vl/vl_deint_filter.c @@ -497,7 +497,7 @@ vl_deint_filter_render(struct vl_deint_filter *filter, sampler_views[1] = prev_sv[k]; sampler_views[2] = cur_sv[k]; sampler_views[3] = next_sv[k]; - filter->pipe->set_sampler_views(filter->pipe, PIPE_SHADER_FRAGMENT, 0, 4, sampler_views); + filter->pipe->set_sampler_views(filter->pipe, PIPE_SHADER_FRAGMENT, 0, 4, 0, sampler_views); /* blit current field */ fb_state.cbufs[0] = blit_surf; diff --git a/src/gallium/auxiliary/vl/vl_idct.c b/src/gallium/auxiliary/vl/vl_idct.c index 1c35ef9e30f..f3ad2fbe2cb 100644 --- a/src/gallium/auxiliary/vl/vl_idct.c +++ b/src/gallium/auxiliary/vl/vl_idct.c @@ -827,7 +827,7 @@ vl_idct_flush(struct vl_idct *idct, struct vl_idct_buffer *buffer, unsigned num_ idct->pipe->bind_sampler_states(idct->pipe, PIPE_SHADER_FRAGMENT, 0, 2, idct->samplers); - idct->pipe->set_sampler_views(idct->pipe, PIPE_SHADER_FRAGMENT, 0, 2, + idct->pipe->set_sampler_views(idct->pipe, PIPE_SHADER_FRAGMENT, 0, 2, 0, buffer->sampler_views.stage[0]); /* mismatch control */ @@ -855,6 +855,6 @@ vl_idct_prepare_stage2(struct vl_idct *idct, struct vl_idct_buffer *buffer) idct->pipe->bind_sampler_states(idct->pipe, PIPE_SHADER_FRAGMENT, 0, 2, idct->samplers); idct->pipe->set_sampler_views(idct->pipe, PIPE_SHADER_FRAGMENT, - 0, 2, buffer->sampler_views.stage[1]); + 0, 2, 0, buffer->sampler_views.stage[1]); } diff --git a/src/gallium/auxiliary/vl/vl_matrix_filter.c b/src/gallium/auxiliary/vl/vl_matrix_filter.c index bbc09bfeb31..d79ecaa4d5c 100644 --- a/src/gallium/auxiliary/vl/vl_matrix_filter.c +++ b/src/gallium/auxiliary/vl/vl_matrix_filter.c @@ -291,7 +291,7 @@ vl_matrix_filter_render(struct vl_matrix_filter *filter, filter->pipe->bind_sampler_states(filter->pipe, PIPE_SHADER_FRAGMENT, 0, 1, &filter->sampler); filter->pipe->set_sampler_views(filter->pipe, PIPE_SHADER_FRAGMENT, - 0, 1, &src); + 0, 1, 0, &src); filter->pipe->bind_vs_state(filter->pipe, filter->vs); filter->pipe->bind_fs_state(filter->pipe, filter->fs); filter->pipe->set_framebuffer_state(filter->pipe, &fb_state); diff --git a/src/gallium/auxiliary/vl/vl_mc.c b/src/gallium/auxiliary/vl/vl_mc.c index 414aff9623f..ff923df9b8e 100644 --- a/src/gallium/auxiliary/vl/vl_mc.c +++ b/src/gallium/auxiliary/vl/vl_mc.c @@ -618,7 +618,7 @@ vl_mc_render_ref(struct vl_mc *renderer, struct vl_mc_buffer *buffer, struct pip renderer->pipe->bind_fs_state(renderer->pipe, renderer->fs_ref); renderer->pipe->set_sampler_views(renderer->pipe, PIPE_SHADER_FRAGMENT, - 0, 1, &ref); + 0, 1, 0, &ref); renderer->pipe->bind_sampler_states(renderer->pipe, PIPE_SHADER_FRAGMENT, 0, 1, &renderer->sampler_ref); diff --git a/src/gallium/auxiliary/vl/vl_median_filter.c b/src/gallium/auxiliary/vl/vl_median_filter.c index 6b69295bd7e..02b205ec72a 100644 --- a/src/gallium/auxiliary/vl/vl_median_filter.c +++ b/src/gallium/auxiliary/vl/vl_median_filter.c @@ -395,7 +395,7 @@ vl_median_filter_render(struct vl_median_filter *filter, filter->pipe->bind_sampler_states(filter->pipe, PIPE_SHADER_FRAGMENT, 0, 1, &filter->sampler); filter->pipe->set_sampler_views(filter->pipe, PIPE_SHADER_FRAGMENT, - 0, 1, &src); + 0, 1, 0, &src); filter->pipe->bind_vs_state(filter->pipe, filter->vs); filter->pipe->bind_fs_state(filter->pipe, filter->fs); filter->pipe->set_framebuffer_state(filter->pipe, &fb_state); diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c b/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c index 7a617d3498b..a406f089101 100644 --- a/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c +++ b/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c @@ -830,7 +830,7 @@ vl_mpeg12_end_frame(struct pipe_video_codec *decoder, vl_idct_prepare_stage2(i ? &dec->idct_c : &dec->idct_y, &buf->idct[plane]); else { dec->context->set_sampler_views(dec->context, - PIPE_SHADER_FRAGMENT, 0, 1, + PIPE_SHADER_FRAGMENT, 0, 1, 0, &mc_source_sv[plane]); dec->context->bind_sampler_states(dec->context, PIPE_SHADER_FRAGMENT, diff --git a/src/gallium/auxiliary/vl/vl_zscan.c b/src/gallium/auxiliary/vl/vl_zscan.c index 82f7a5eab23..0450126d2f8 100644 --- a/src/gallium/auxiliary/vl/vl_zscan.c +++ b/src/gallium/auxiliary/vl/vl_zscan.c @@ -604,7 +604,7 @@ vl_zscan_render(struct vl_zscan *zscan, struct vl_zscan_buffer *buffer, unsigned zscan->pipe->set_framebuffer_state(zscan->pipe, &buffer->fb_state); zscan->pipe->set_viewport_states(zscan->pipe, 0, 1, &buffer->viewport); zscan->pipe->set_sampler_views(zscan->pipe, PIPE_SHADER_FRAGMENT, - 0, 3, &buffer->src); + 0, 3, 0, &buffer->src); zscan->pipe->bind_vs_state(zscan->pipe, zscan->vs); zscan->pipe->bind_fs_state(zscan->pipe, zscan->fs); util_draw_arrays_instanced(zscan->pipe, PIPE_PRIM_QUADS, 0, 4, 0, num_instances); diff --git a/src/gallium/drivers/d3d12/d3d12_blit.cpp b/src/gallium/drivers/d3d12/d3d12_blit.cpp index e5216e46c89..0311a6ca59d 100644 --- a/src/gallium/drivers/d3d12/d3d12_blit.cpp +++ b/src/gallium/drivers/d3d12/d3d12_blit.cpp @@ -739,7 +739,7 @@ resolve_stencil_to_temp(struct d3d12_context *ctx, void *sampler_state = get_sampler_state(ctx); util_blit_save_state(ctx); - pctx->set_sampler_views(pctx, PIPE_SHADER_FRAGMENT, 0, 1, &src_view); + pctx->set_sampler_views(pctx, PIPE_SHADER_FRAGMENT, 0, 1, 0, &src_view); pctx->bind_sampler_states(pctx, PIPE_SHADER_FRAGMENT, 0, 1, &sampler_state); util_blitter_custom_shader(ctx->blitter, dst_surf, get_stencil_resolve_vs(ctx), diff --git a/src/gallium/drivers/d3d12/d3d12_context.cpp b/src/gallium/drivers/d3d12/d3d12_context.cpp index f288746fde2..3c7ddacc984 100644 --- a/src/gallium/drivers/d3d12/d3d12_context.cpp +++ b/src/gallium/drivers/d3d12/d3d12_context.cpp @@ -924,10 +924,10 @@ d3d12_set_sampler_views(struct pipe_context *pctx, enum pipe_shader_type shader_type, unsigned start_slot, unsigned num_views, + unsigned unbind_num_trailing_slots, struct pipe_sampler_view **views) { struct d3d12_context *ctx = d3d12_context(pctx); - assert(views); unsigned shader_bit = (1 << shader_type); ctx->has_int_samplers &= ~shader_bit; @@ -964,6 +964,11 @@ d3d12_set_sampler_views(struct pipe_context *pctx, swizzle_state.swizzle_a = ss->swizzle_override_a; } } + + for (unsigned i = 0; i < unbind_num_trailing_slots; i++) + pipe_sampler_view_reference( + &ctx->sampler_views[shader_type][start_slot + num_views + i], NULL); + ctx->num_sampler_views[shader_type] = start_slot + num_views; ctx->shader_dirty[shader_type] |= D3D12_SHADER_DIRTY_SAMPLER_VIEWS; } diff --git a/src/gallium/drivers/etnaviv/etnaviv_texture.c b/src/gallium/drivers/etnaviv/etnaviv_texture.c index ac3f85269dd..add31ff19c9 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_texture.c +++ b/src/gallium/drivers/etnaviv/etnaviv_texture.c @@ -293,6 +293,7 @@ etna_vertex_set_sampler_views(struct etna_context *ctx, unsigned nr, static void etna_set_sampler_views(struct pipe_context *pctx, enum pipe_shader_type shader, unsigned start_slot, unsigned num_views, + unsigned unbind_num_trailing_slots, struct pipe_sampler_view **views) { struct etna_context *ctx = etna_context(pctx); diff --git a/src/gallium/drivers/freedreno/a2xx/fd2_texture.c b/src/gallium/drivers/freedreno/a2xx/fd2_texture.c index 57cab74082c..cc9e4d860ac 100644 --- a/src/gallium/drivers/freedreno/a2xx/fd2_texture.c +++ b/src/gallium/drivers/freedreno/a2xx/fd2_texture.c @@ -212,7 +212,7 @@ fd2_sampler_view_create(struct pipe_context *pctx, struct pipe_resource *prsc, static void fd2_set_sampler_views(struct pipe_context *pctx, enum pipe_shader_type shader, - unsigned start, unsigned nr, + unsigned start, unsigned nr, unsigned unbind_num_trailing_slots, struct pipe_sampler_view **views) { if (shader == PIPE_SHADER_FRAGMENT) { @@ -226,7 +226,7 @@ fd2_set_sampler_views(struct pipe_context *pctx, enum pipe_shader_type shader, ctx->dirty |= FD_DIRTY_TEXSTATE; } - fd_set_sampler_views(pctx, shader, start, nr, views); + fd_set_sampler_views(pctx, shader, start, nr, unbind_num_trailing_slots, views); } /* map gallium sampler-id to hw const-idx.. adreno uses a flat address diff --git a/src/gallium/drivers/freedreno/a4xx/fd4_texture.c b/src/gallium/drivers/freedreno/a4xx/fd4_texture.c index e1f9f24be43..16fbb463419 100644 --- a/src/gallium/drivers/freedreno/a4xx/fd4_texture.c +++ b/src/gallium/drivers/freedreno/a4xx/fd4_texture.c @@ -320,7 +320,7 @@ fd4_sampler_view_create(struct pipe_context *pctx, struct pipe_resource *prsc, static void fd4_set_sampler_views(struct pipe_context *pctx, enum pipe_shader_type shader, - unsigned start, unsigned nr, + unsigned start, unsigned nr, unsigned unbind_num_trailing_slots, struct pipe_sampler_view **views) { struct fd_context *ctx = fd_context(pctx); @@ -337,7 +337,7 @@ fd4_set_sampler_views(struct pipe_context *pctx, enum pipe_shader_type shader, } } - fd_set_sampler_views(pctx, shader, start, nr, views); + fd_set_sampler_views(pctx, shader, start, nr, unbind_num_trailing_slots, views); if (shader == PIPE_SHADER_FRAGMENT) { fd4_ctx->fastc_srgb = astc_srgb; diff --git a/src/gallium/drivers/freedreno/a5xx/fd5_texture.c b/src/gallium/drivers/freedreno/a5xx/fd5_texture.c index 84e66d504ab..370b9e9f931 100644 --- a/src/gallium/drivers/freedreno/a5xx/fd5_texture.c +++ b/src/gallium/drivers/freedreno/a5xx/fd5_texture.c @@ -319,7 +319,7 @@ fd5_sampler_view_create(struct pipe_context *pctx, struct pipe_resource *prsc, static void fd5_set_sampler_views(struct pipe_context *pctx, enum pipe_shader_type shader, - unsigned start, unsigned nr, + unsigned start, unsigned nr, unsigned unbind_num_trailing_slots, struct pipe_sampler_view **views) { struct fd_context *ctx = fd_context(pctx); @@ -336,7 +336,7 @@ fd5_set_sampler_views(struct pipe_context *pctx, enum pipe_shader_type shader, } } - fd_set_sampler_views(pctx, shader, start, nr, views); + fd_set_sampler_views(pctx, shader, start, nr, unbind_num_trailing_slots, views); if (shader == PIPE_SHADER_FRAGMENT) { fd5_ctx->fastc_srgb = astc_srgb; diff --git a/src/gallium/drivers/freedreno/freedreno_texture.c b/src/gallium/drivers/freedreno/freedreno_texture.c index 7ffa5c1ed85..f70c372d4a2 100644 --- a/src/gallium/drivers/freedreno/freedreno_texture.c +++ b/src/gallium/drivers/freedreno/freedreno_texture.c @@ -66,7 +66,9 @@ static void bind_sampler_states(struct fd_texture_stateobj *tex, } static void set_sampler_views(struct fd_texture_stateobj *tex, - unsigned start, unsigned nr, struct pipe_sampler_view **views) + unsigned start, unsigned nr, + unsigned unbind_num_trailing_slots, + struct pipe_sampler_view **views) { unsigned i; unsigned samplers = 0; @@ -82,6 +84,11 @@ static void set_sampler_views(struct fd_texture_stateobj *tex, tex->valid_textures &= ~(1 << p); } } + for (; i < nr + unbind_num_trailing_slots; i++) { + unsigned p = i + start; + pipe_sampler_view_reference(&tex->textures[p], NULL); + tex->valid_textures &= ~(1 << p); + } tex->num_textures = util_last_bit(tex->valid_textures); @@ -107,12 +114,12 @@ fd_sampler_states_bind(struct pipe_context *pctx, void fd_set_sampler_views(struct pipe_context *pctx, enum pipe_shader_type shader, - unsigned start, unsigned nr, + unsigned start, unsigned nr, unsigned unbind_num_trailing_slots, struct pipe_sampler_view **views) { struct fd_context *ctx = fd_context(pctx); - set_sampler_views(&ctx->tex[shader], start, nr, views); + set_sampler_views(&ctx->tex[shader], start, nr, unbind_num_trailing_slots, views); ctx->dirty_shader[shader] |= FD_DIRTY_SHADER_TEX; ctx->dirty |= FD_DIRTY_TEX; } diff --git a/src/gallium/drivers/freedreno/freedreno_texture.h b/src/gallium/drivers/freedreno/freedreno_texture.h index 94fb2e810f2..f38dd9b4571 100644 --- a/src/gallium/drivers/freedreno/freedreno_texture.h +++ b/src/gallium/drivers/freedreno/freedreno_texture.h @@ -36,6 +36,7 @@ void fd_sampler_states_bind(struct pipe_context *pctx, void fd_set_sampler_views(struct pipe_context *pctx, enum pipe_shader_type shader, unsigned start, unsigned nr, + unsigned unbind_num_trailing_slots, struct pipe_sampler_view **views); void fd_texture_init(struct pipe_context *pctx); diff --git a/src/gallium/drivers/i915/i915_state.c b/src/gallium/drivers/i915/i915_state.c index f7da9f53d4e..ea26e478199 100644 --- a/src/gallium/drivers/i915/i915_state.c +++ b/src/gallium/drivers/i915/i915_state.c @@ -746,7 +746,7 @@ static void i915_set_fragment_sampler_views(struct pipe_context *pipe, assert(num <= PIPE_MAX_SAMPLERS); /* Check for no-op */ - if (num == i915->num_fragment_sampler_views && + if (views && num == i915->num_fragment_sampler_views && !memcmp(i915->fragment_sampler_views, views, num * sizeof(struct pipe_sampler_view *))) return; @@ -773,7 +773,7 @@ i915_set_vertex_sampler_views(struct pipe_context *pipe, assert(num <= ARRAY_SIZE(i915->vertex_sampler_views)); /* Check for no-op */ - if (num == i915->num_vertex_sampler_views && + if (views && num == i915->num_vertex_sampler_views && !memcmp(i915->vertex_sampler_views, views, num * sizeof(struct pipe_sampler_view *))) { return; } @@ -795,7 +795,7 @@ i915_set_vertex_sampler_views(struct pipe_context *pipe, static void i915_set_sampler_views(struct pipe_context *pipe, enum pipe_shader_type shader, - unsigned start, unsigned num, + unsigned start, unsigned num, unsigned unbind_num_trailing_slots, struct pipe_sampler_view **views) { assert(start == 0); diff --git a/src/gallium/drivers/iris/iris_state.c b/src/gallium/drivers/iris/iris_state.c index be9862a6565..510615c33f0 100644 --- a/src/gallium/drivers/iris/iris_state.c +++ b/src/gallium/drivers/iris/iris_state.c @@ -2856,15 +2856,17 @@ static void iris_set_sampler_views(struct pipe_context *ctx, enum pipe_shader_type p_stage, unsigned start, unsigned count, + unsigned unbind_num_trailing_slots, struct pipe_sampler_view **views) { struct iris_context *ice = (struct iris_context *) ctx; gl_shader_stage stage = stage_from_pipe(p_stage); struct iris_shader_state *shs = &ice->state.shaders[stage]; + unsigned i; shs->bound_sampler_views &= ~u_bit_consecutive(start, count); - for (unsigned i = 0; i < count; i++) { + for (i = 0; i < count; i++) { struct pipe_sampler_view *pview = views ? views[i] : NULL; pipe_sampler_view_reference((struct pipe_sampler_view **) &shs->textures[start + i], pview); @@ -2879,6 +2881,10 @@ iris_set_sampler_views(struct pipe_context *ctx, &view->surface_state, view->res->bo); } } + for (; i < count + unbind_num_trailing_slots; i++) { + pipe_sampler_view_reference((struct pipe_sampler_view **) + &shs->textures[start + i], NULL); + } ice->state.stage_dirty |= (IRIS_STAGE_DIRTY_BINDINGS_VS << stage); ice->state.dirty |= diff --git a/src/gallium/drivers/lima/lima_state.c b/src/gallium/drivers/lima/lima_state.c index e7d682a4e2a..1c8fbf37d4b 100644 --- a/src/gallium/drivers/lima/lima_state.c +++ b/src/gallium/drivers/lima/lima_state.c @@ -371,6 +371,7 @@ static void lima_set_sampler_views(struct pipe_context *pctx, enum pipe_shader_type shader, unsigned start, unsigned nr, + unsigned unbind_num_trailing_slots, struct pipe_sampler_view **views) { struct lima_context *ctx = lima_context(pctx); diff --git a/src/gallium/drivers/llvmpipe/lp_state_sampler.c b/src/gallium/drivers/llvmpipe/lp_state_sampler.c index 4f8217b769a..613e5286a2a 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_sampler.c +++ b/src/gallium/drivers/llvmpipe/lp_state_sampler.c @@ -119,6 +119,7 @@ llvmpipe_set_sampler_views(struct pipe_context *pipe, enum pipe_shader_type shader, unsigned start, unsigned num, + unsigned unbind_num_trailing_slots, struct pipe_sampler_view **views) { struct llvmpipe_context *llvmpipe = llvmpipe_context(pipe); @@ -153,6 +154,11 @@ llvmpipe_set_sampler_views(struct pipe_context *pipe, view); } + for (; i < num + unbind_num_trailing_slots; i++) { + pipe_sampler_view_reference(&llvmpipe->sampler_views[shader][start + i], + NULL); + } + /* find highest non-null sampler_views[] entry */ { unsigned j = MAX2(llvmpipe->num_sampler_views[shader], start + num); diff --git a/src/gallium/drivers/nouveau/nv30/nv30_fragtex.c b/src/gallium/drivers/nouveau/nv30/nv30_fragtex.c index a6bfee6f0bb..bfd3cf2b486 100644 --- a/src/gallium/drivers/nouveau/nv30/nv30_fragtex.c +++ b/src/gallium/drivers/nouveau/nv30/nv30_fragtex.c @@ -198,6 +198,7 @@ nv30_fragtex_set_sampler_views(struct pipe_context *pipe, unsigned nr, static void nv30_set_sampler_views(struct pipe_context *pipe, enum pipe_shader_type shader, unsigned start, unsigned nr, + unsigned unbind_num_trailing_slots, struct pipe_sampler_view **views) { assert(start == 0); diff --git a/src/gallium/drivers/nouveau/nv50/nv50_state.c b/src/gallium/drivers/nouveau/nv50/nv50_state.c index f3d67bdc5ba..e40ab1b7268 100644 --- a/src/gallium/drivers/nouveau/nv50/nv50_state.c +++ b/src/gallium/drivers/nouveau/nv50/nv50_state.c @@ -725,6 +725,7 @@ nv50_stage_set_sampler_views(struct nv50_context *nv50, int s, static void nv50_set_sampler_views(struct pipe_context *pipe, enum pipe_shader_type shader, unsigned start, unsigned nr, + unsigned unbind_num_trailing_slots, struct pipe_sampler_view **views) { assert(start == 0); diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_state.c b/src/gallium/drivers/nouveau/nvc0/nvc0_state.c index 02942d52ee3..ade5880cf5c 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_state.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_state.c @@ -569,6 +569,7 @@ nvc0_stage_set_sampler_views(struct nvc0_context *nvc0, int s, static void nvc0_set_sampler_views(struct pipe_context *pipe, enum pipe_shader_type shader, unsigned start, unsigned nr, + unsigned unbind_num_trailing_slots, struct pipe_sampler_view **views) { const unsigned s = nvc0_shader_stage(shader); diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c index 1600e26fc99..396ce1c5c4d 100644 --- a/src/gallium/drivers/panfrost/pan_context.c +++ b/src/gallium/drivers/panfrost/pan_context.c @@ -1185,6 +1185,7 @@ panfrost_set_sampler_views( struct pipe_context *pctx, enum pipe_shader_type shader, unsigned start_slot, unsigned num_views, + unsigned unbind_num_trailing_slots, struct pipe_sampler_view **views) { struct panfrost_context *ctx = pan_context(pctx); diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index 9049c30ce7c..1caf3e3e3a7 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -1518,6 +1518,7 @@ static uint32_t r300_assign_texture_cache_region(unsigned index, unsigned num) static void r300_set_sampler_views(struct pipe_context* pipe, enum pipe_shader_type shader, unsigned start, unsigned count, + unsigned unbind_num_trailing_slots, struct pipe_sampler_view** views) { struct r300_context* r300 = r300_context(pipe); diff --git a/src/gallium/drivers/r600/r600_state_common.c b/src/gallium/drivers/r600/r600_state_common.c index ce4e784b412..d787be33d70 100644 --- a/src/gallium/drivers/r600/r600_state_common.c +++ b/src/gallium/drivers/r600/r600_state_common.c @@ -632,6 +632,7 @@ void r600_sampler_views_dirty(struct r600_context *rctx, static void r600_set_sampler_views(struct pipe_context *pipe, enum pipe_shader_type shader, unsigned start, unsigned count, + unsigned unbind_num_trailing_slots, struct pipe_sampler_view **views) { struct r600_context *rctx = (struct r600_context *) pipe; diff --git a/src/gallium/drivers/radeonsi/si_descriptors.c b/src/gallium/drivers/radeonsi/si_descriptors.c index 6139769c86a..426591ce1dd 100644 --- a/src/gallium/drivers/radeonsi/si_descriptors.c +++ b/src/gallium/drivers/radeonsi/si_descriptors.c @@ -573,12 +573,14 @@ static void si_update_shader_needs_decompress_mask(struct si_context *sctx, unsi } static void si_set_sampler_views(struct pipe_context *ctx, enum pipe_shader_type shader, - unsigned start, unsigned count, struct pipe_sampler_view **views) + unsigned start, unsigned count, + unsigned unbind_num_trailing_slots, + struct pipe_sampler_view **views) { struct si_context *sctx = (struct si_context *)ctx; int i; - if (!count || shader >= SI_NUM_SHADERS) + if ((!count && !unbind_num_trailing_slots) || shader >= SI_NUM_SHADERS) return; if (views) { @@ -589,6 +591,9 @@ static void si_set_sampler_views(struct pipe_context *ctx, enum pipe_shader_type si_set_sampler_view(sctx, shader, start + i, NULL, false); } + for (; i < count + unbind_num_trailing_slots; i++) + si_set_sampler_view(sctx, shader, start + i, NULL, false); + si_update_shader_needs_decompress_mask(sctx, shader); } diff --git a/src/gallium/drivers/softpipe/sp_state.h b/src/gallium/drivers/softpipe/sp_state.h index a9ae401de80..3971bbf6a63 100644 --- a/src/gallium/drivers/softpipe/sp_state.h +++ b/src/gallium/drivers/softpipe/sp_state.h @@ -175,6 +175,7 @@ softpipe_set_sampler_views(struct pipe_context *pipe, enum pipe_shader_type shader, unsigned start, unsigned num, + unsigned unbind_num_trailing_slots, struct pipe_sampler_view **views); diff --git a/src/gallium/drivers/softpipe/sp_state_derived.c b/src/gallium/drivers/softpipe/sp_state_derived.c index b4f87e02666..d120abf0f0e 100644 --- a/src/gallium/drivers/softpipe/sp_state_derived.c +++ b/src/gallium/drivers/softpipe/sp_state_derived.c @@ -420,7 +420,7 @@ update_polygon_stipple_enable(struct softpipe_context *softpipe, unsigned prim) /* sampler view state */ softpipe_set_sampler_views(&softpipe->pipe, PIPE_SHADER_FRAGMENT, - unit, 1, &softpipe->pstipple.sampler_view); + unit, 1, 0, &softpipe->pstipple.sampler_view); softpipe->dirty |= SP_NEW_SAMPLER; } diff --git a/src/gallium/drivers/softpipe/sp_state_sampler.c b/src/gallium/drivers/softpipe/sp_state_sampler.c index 70d34ed790c..b6a97c13c41 100644 --- a/src/gallium/drivers/softpipe/sp_state_sampler.c +++ b/src/gallium/drivers/softpipe/sp_state_sampler.c @@ -100,6 +100,7 @@ softpipe_set_sampler_views(struct pipe_context *pipe, enum pipe_shader_type shader, unsigned start, unsigned num, + unsigned unbind_num_trailing_slots, struct pipe_sampler_view **views) { struct softpipe_context *softpipe = softpipe_context(pipe); @@ -134,6 +135,12 @@ softpipe_set_sampler_views(struct pipe_context *pipe, memset(sp_sviewdst, 0, sizeof(*sp_sviewsrc)); } } + for (; i < num + unbind_num_trailing_slots; i++) { + struct pipe_sampler_view **pview = &softpipe->sampler_views[shader][start + i]; + pipe_sampler_view_reference(pview, NULL); + sp_tex_tile_cache_set_sampler_view(softpipe->tex_cache[shader][start + i], + NULL); + } /* find highest non-null sampler_views[] entry */ diff --git a/src/gallium/drivers/svga/svga_pipe_sampler.c b/src/gallium/drivers/svga/svga_pipe_sampler.c index d73a5816be1..eb23b7b725a 100644 --- a/src/gallium/drivers/svga/svga_pipe_sampler.c +++ b/src/gallium/drivers/svga/svga_pipe_sampler.c @@ -414,6 +414,7 @@ svga_set_sampler_views(struct pipe_context *pipe, enum pipe_shader_type shader, unsigned start, unsigned num, + unsigned unbind_num_trailing_slots, struct pipe_sampler_view **views) { struct svga_context *svga = svga_context(pipe); @@ -475,6 +476,14 @@ svga_set_sampler_views(struct pipe_context *pipe, } } + for (; i < num + unbind_num_trailing_slots; i++) { + if (svga->curr.sampler_views[shader][start + i]) { + pipe_sampler_view_reference(&svga->curr.sampler_views[shader][start + i], + NULL); + any_change = TRUE; + } + } + if (!any_change) { goto done; } diff --git a/src/gallium/drivers/swr/swr_state.cpp b/src/gallium/drivers/swr/swr_state.cpp index 3089baf9ef5..bde7f35c377 100644 --- a/src/gallium/drivers/swr/swr_state.cpp +++ b/src/gallium/drivers/swr/swr_state.cpp @@ -300,6 +300,7 @@ swr_set_sampler_views(struct pipe_context *pipe, enum pipe_shader_type shader, unsigned start, unsigned num, + unsigned unbind_num_trailing_slots, struct pipe_sampler_view **views) { struct swr_context *ctx = swr_context(pipe); @@ -316,6 +317,10 @@ swr_set_sampler_views(struct pipe_context *pipe, pipe_sampler_view_reference(&ctx->sampler_views[shader][start + i], views[i]); } + for (; i < num + unbind_num_trailing_slots; i++) { + pipe_sampler_view_reference(&ctx->sampler_views[shader][start + i], + NULL); + } ctx->dirty |= SWR_NEW_SAMPLER_VIEW; } diff --git a/src/gallium/drivers/tegra/tegra_context.c b/src/gallium/drivers/tegra/tegra_context.c index aca256824ff..bda565bfea6 100644 --- a/src/gallium/drivers/tegra/tegra_context.c +++ b/src/gallium/drivers/tegra/tegra_context.c @@ -564,6 +564,7 @@ tegra_set_viewport_states(struct pipe_context *pcontext, unsigned start_slot, static void tegra_set_sampler_views(struct pipe_context *pcontext, unsigned shader, unsigned start_slot, unsigned num_views, + unsigned unbind_num_trailing_slots, struct pipe_sampler_view **pviews) { struct pipe_sampler_view *views[PIPE_MAX_SHADER_SAMPLER_VIEWS]; @@ -574,7 +575,8 @@ tegra_set_sampler_views(struct pipe_context *pcontext, unsigned shader, views[i] = tegra_sampler_view_unwrap(pviews[i]); context->gpu->set_sampler_views(context->gpu, shader, start_slot, - num_views, views); + num_views, unbind_num_trailing_slots, + views); } static void diff --git a/src/gallium/drivers/v3d/v3dx_state.c b/src/gallium/drivers/v3d/v3dx_state.c index 86fe97decfd..1074ef513a2 100644 --- a/src/gallium/drivers/v3d/v3dx_state.c +++ b/src/gallium/drivers/v3d/v3dx_state.c @@ -1156,6 +1156,7 @@ static void v3d_set_sampler_views(struct pipe_context *pctx, enum pipe_shader_type shader, unsigned start, unsigned nr, + unsigned unbind_num_trailing_slots, struct pipe_sampler_view **views) { struct v3d_context *v3d = v3d_context(pctx); diff --git a/src/gallium/drivers/vc4/vc4_blit.c b/src/gallium/drivers/vc4/vc4_blit.c index 87de6617836..5e505597436 100644 --- a/src/gallium/drivers/vc4/vc4_blit.c +++ b/src/gallium/drivers/vc4/vc4_blit.c @@ -381,7 +381,7 @@ vc4_yuv_blit(struct pipe_context *pctx, const struct pipe_blit_info *info) /* Unbind the textures, to make sure we don't try to recurse into the * shadow blit. */ - pctx->set_sampler_views(pctx, PIPE_SHADER_FRAGMENT, 0, 0, NULL); + pctx->set_sampler_views(pctx, PIPE_SHADER_FRAGMENT, 0, 0, 0, NULL); pctx->bind_sampler_states(pctx, PIPE_SHADER_FRAGMENT, 0, 0, NULL); util_blitter_custom_shader(vc4->blitter, dst_surf, diff --git a/src/gallium/drivers/vc4/vc4_state.c b/src/gallium/drivers/vc4/vc4_state.c index 3c174185502..4e4cff11038 100644 --- a/src/gallium/drivers/vc4/vc4_state.c +++ b/src/gallium/drivers/vc4/vc4_state.c @@ -649,6 +649,7 @@ static void vc4_set_sampler_views(struct pipe_context *pctx, enum pipe_shader_type shader, unsigned start, unsigned nr, + unsigned unbind_num_trailing_slots, struct pipe_sampler_view **views) { struct vc4_context *vc4 = vc4_context(pctx); diff --git a/src/gallium/drivers/virgl/virgl_context.c b/src/gallium/drivers/virgl/virgl_context.c index 2e42f1bfe92..0db8232cb1e 100644 --- a/src/gallium/drivers/virgl/virgl_context.c +++ b/src/gallium/drivers/virgl/virgl_context.c @@ -1015,6 +1015,7 @@ static void virgl_set_sampler_views(struct pipe_context *ctx, enum pipe_shader_type shader_type, unsigned start_slot, unsigned num_views, + unsigned unbind_num_trailing_slots, struct pipe_sampler_view **views) { struct virgl_context *vctx = virgl_context(ctx); @@ -1038,6 +1039,11 @@ static void virgl_set_sampler_views(struct pipe_context *ctx, virgl_encode_set_sampler_views(vctx, shader_type, start_slot, num_views, (struct virgl_sampler_view **)binding->views); virgl_attach_res_sampler_views(vctx, shader_type); + + if (unbind_num_trailing_slots) { + virgl_set_sampler_views(ctx, shader_type, start_slot + num_views, + unbind_num_trailing_slots, 0, NULL); + } } static void diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c index eec6f16204b..bfd3bf32a3c 100644 --- a/src/gallium/drivers/zink/zink_context.c +++ b/src/gallium/drivers/zink/zink_context.c @@ -674,15 +674,23 @@ zink_set_sampler_views(struct pipe_context *pctx, enum pipe_shader_type shader_type, unsigned start_slot, unsigned num_views, + unsigned unbind_num_trailing_slots, struct pipe_sampler_view **views) { struct zink_context *ctx = zink_context(pctx); - for (unsigned i = 0; i < num_views; ++i) { + unsigned i; + + for (i = 0; i < num_views; ++i) { struct pipe_sampler_view *pview = views ? views[i] : NULL; pipe_sampler_view_reference( &ctx->sampler_views[shader_type][start_slot + i], pview); } + for (; i < num_views + unbind_num_trailing_slots; ++i) { + pipe_sampler_view_reference( + &ctx->sampler_views[shader_type][start_slot + i], + NULL); + } ctx->num_sampler_views[shader_type] = start_slot + num_views; } diff --git a/src/gallium/frontends/clover/core/kernel.cpp b/src/gallium/frontends/clover/core/kernel.cpp index fad6b7568ba..1629e34f931 100644 --- a/src/gallium/frontends/clover/core/kernel.cpp +++ b/src/gallium/frontends/clover/core/kernel.cpp @@ -82,7 +82,7 @@ kernel::launch(command_queue &q, exec.samplers.data()); q.pipe->set_sampler_views(q.pipe, PIPE_SHADER_COMPUTE, 0, - exec.sviews.size(), exec.sviews.data()); + exec.sviews.size(), 0, exec.sviews.data()); q.pipe->set_shader_images(q.pipe, PIPE_SHADER_COMPUTE, 0, exec.iviews.size(), 0, exec.iviews.data()); q.pipe->set_compute_resources(q.pipe, 0, exec.resources.size(), @@ -104,7 +104,7 @@ kernel::launch(command_queue &q, q.pipe->set_shader_images(q.pipe, PIPE_SHADER_COMPUTE, 0, 0, exec.iviews.size(), NULL); q.pipe->set_sampler_views(q.pipe, PIPE_SHADER_COMPUTE, 0, - exec.sviews.size(), NULL); + 0, exec.sviews.size(), NULL); q.pipe->bind_sampler_states(q.pipe, PIPE_SHADER_COMPUTE, 0, exec.samplers.size(), NULL); diff --git a/src/gallium/frontends/lavapipe/lvp_execute.c b/src/gallium/frontends/lavapipe/lvp_execute.c index be624c9fc0e..ae1b16914cc 100644 --- a/src/gallium/frontends/lavapipe/lvp_execute.c +++ b/src/gallium/frontends/lavapipe/lvp_execute.c @@ -162,7 +162,7 @@ static void emit_compute_state(struct rendering_state *state) if (state->sv_dirty[PIPE_SHADER_COMPUTE]) { state->pctx->set_sampler_views(state->pctx, PIPE_SHADER_COMPUTE, 0, state->num_sampler_views[PIPE_SHADER_COMPUTE], - state->sv[PIPE_SHADER_COMPUTE]); + 0, state->sv[PIPE_SHADER_COMPUTE]); state->sv_dirty[PIPE_SHADER_COMPUTE] = false; } @@ -292,7 +292,7 @@ static void emit_state(struct rendering_state *state) continue; state->pctx->set_sampler_views(state->pctx, sh, 0, state->num_sampler_views[sh], - state->sv[sh]); + 0, state->sv[sh]); state->sv_dirty[sh] = false; } diff --git a/src/gallium/frontends/nine/nine_state.c b/src/gallium/frontends/nine/nine_state.c index 3d0461d374f..85bc920bf5c 100644 --- a/src/gallium/frontends/nine/nine_state.c +++ b/src/gallium/frontends/nine/nine_state.c @@ -1013,7 +1013,7 @@ update_textures_and_samplers(struct NineDevice9 *device) context->bound_samplers_mask_ps |= (1 << s); } - pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, num_textures, view); + pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, num_textures, 0, view); if (commit_samplers) cso_single_sampler_done(context->cso, PIPE_SHADER_FRAGMENT); @@ -1061,7 +1061,7 @@ update_textures_and_samplers(struct NineDevice9 *device) context->bound_samplers_mask_vs |= (1 << i); } - pipe->set_sampler_views(pipe, PIPE_SHADER_VERTEX, 0, num_textures, view); + pipe->set_sampler_views(pipe, PIPE_SHADER_VERTEX, 0, num_textures, 0, view); if (commit_samplers) cso_single_sampler_done(context->cso, PIPE_SHADER_VERTEX); @@ -2913,8 +2913,8 @@ nine_context_clear(struct NineDevice9 *device) cso_set_samplers(cso, PIPE_SHADER_VERTEX, 0, NULL); cso_set_samplers(cso, PIPE_SHADER_FRAGMENT, 0, NULL); - pipe->set_sampler_views(pipe, PIPE_SHADER_VERTEX, 0, NINE_MAX_SAMPLERS_VS, NULL); - pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, NINE_MAX_SAMPLERS_PS, NULL); + pipe->set_sampler_views(pipe, PIPE_SHADER_VERTEX, 0, 0, NINE_MAX_SAMPLERS_VS, NULL); + pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, 0, NINE_MAX_SAMPLERS_PS, NULL); pipe->set_vertex_buffers(pipe, 0, 0, device->caps.MaxStreams, NULL); diff --git a/src/gallium/frontends/xa/xa_composite.c b/src/gallium/frontends/xa/xa_composite.c index 45bc031e8c0..c0d80855f14 100644 --- a/src/gallium/frontends/xa/xa_composite.c +++ b/src/gallium/frontends/xa/xa_composite.c @@ -504,7 +504,7 @@ bind_samplers(struct xa_context *ctx, cso_set_samplers(ctx->cso, PIPE_SHADER_FRAGMENT, num_samplers, (const struct pipe_sampler_state **)samplers); - pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, num_samplers, + pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, num_samplers, 0, ctx->bound_sampler_views); ctx->num_bound_samplers = num_samplers; } diff --git a/src/gallium/frontends/xa/xa_context.c b/src/gallium/frontends/xa/xa_context.c index dc9586dd4b0..4307e3f9a73 100644 --- a/src/gallium/frontends/xa/xa_context.c +++ b/src/gallium/frontends/xa/xa_context.c @@ -327,7 +327,7 @@ xa_solid_prepare(struct xa_context *ctx, struct xa_surface *dst, renderer_bind_destination(ctx, ctx->srf); bind_solid_blend_state(ctx); cso_set_samplers(ctx->cso, PIPE_SHADER_FRAGMENT, 0, NULL); - ctx->pipe->set_sampler_views(ctx->pipe, PIPE_SHADER_FRAGMENT, 0, XA_MAX_SAMPLERS, NULL); + ctx->pipe->set_sampler_views(ctx->pipe, PIPE_SHADER_FRAGMENT, 0, 0, XA_MAX_SAMPLERS, NULL); shader = xa_shaders_get(ctx->shaders, vs_traits, fs_traits); cso_set_vertex_shader_handle(ctx->cso, shader.vs); diff --git a/src/gallium/frontends/xa/xa_renderer.c b/src/gallium/frontends/xa/xa_renderer.c index 91d129b0338..7b7fdce9d59 100644 --- a/src/gallium/frontends/xa/xa_renderer.c +++ b/src/gallium/frontends/xa/xa_renderer.c @@ -442,7 +442,7 @@ renderer_copy_prepare(struct xa_context *r, u_sampler_view_default_template(&templ, src_texture, src_texture->format); src_view = pipe->create_sampler_view(pipe, src_texture, &templ); - pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, 1, &src_view); + pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, 1, 0, &src_view); pipe_sampler_view_reference(&src_view, NULL); } diff --git a/src/gallium/frontends/xa/xa_yuv.c b/src/gallium/frontends/xa/xa_yuv.c index ce49aa23d8b..58d43b69cf5 100644 --- a/src/gallium/frontends/xa/xa_yuv.c +++ b/src/gallium/frontends/xa/xa_yuv.c @@ -93,7 +93,7 @@ xa_yuv_bind_samplers(struct xa_context *r, struct xa_surface *yuv[]) } r->num_bound_samplers = 3; cso_set_samplers(r->cso, PIPE_SHADER_FRAGMENT, 3, (const struct pipe_sampler_state **)samplers); - r->pipe->set_sampler_views(r->pipe, PIPE_SHADER_FRAGMENT, 0, 3, r->bound_sampler_views); + r->pipe->set_sampler_views(r->pipe, PIPE_SHADER_FRAGMENT, 0, 3, 0, r->bound_sampler_views); } static void diff --git a/src/gallium/include/pipe/p_context.h b/src/gallium/include/pipe/p_context.h index 1f653e1df27..d99aa1638ec 100644 --- a/src/gallium/include/pipe/p_context.h +++ b/src/gallium/include/pipe/p_context.h @@ -443,6 +443,7 @@ struct pipe_context { void (*set_sampler_views)(struct pipe_context *, enum pipe_shader_type shader, unsigned start_slot, unsigned num_views, + unsigned unbind_num_trailing_slots, struct pipe_sampler_view **views); void (*set_tess_state)(struct pipe_context *, diff --git a/src/gallium/tests/graw/fs-test.c b/src/gallium/tests/graw/fs-test.c index 92b233b363d..5d71772a67b 100644 --- a/src/gallium/tests/graw/fs-test.c +++ b/src/gallium/tests/graw/fs-test.c @@ -350,7 +350,7 @@ static void init_tex( void ) if (sv == NULL) exit(5); - ctx->set_sampler_views(ctx, PIPE_SHADER_FRAGMENT, 0, 1, &sv); + ctx->set_sampler_views(ctx, PIPE_SHADER_FRAGMENT, 0, 1, 0, &sv); memset(&sampler_desc, 0, sizeof sampler_desc); diff --git a/src/gallium/tests/graw/gs-test.c b/src/gallium/tests/graw/gs-test.c index 2e74dbe65c5..c1726863107 100644 --- a/src/gallium/tests/graw/gs-test.c +++ b/src/gallium/tests/graw/gs-test.c @@ -440,7 +440,7 @@ static void init_tex( void ) if (sv == NULL) exit(5); - ctx->set_sampler_views(ctx, PIPE_SHADER_FRAGMENT, 0, 1, &sv); + ctx->set_sampler_views(ctx, PIPE_SHADER_FRAGMENT, 0, 1, 0, &sv); memset(&sampler_desc, 0, sizeof sampler_desc); diff --git a/src/gallium/tests/graw/quad-sample.c b/src/gallium/tests/graw/quad-sample.c index 711f04e7804..b64827e1de3 100644 --- a/src/gallium/tests/graw/quad-sample.c +++ b/src/gallium/tests/graw/quad-sample.c @@ -265,7 +265,7 @@ static void init_tex( void ) if (sv == NULL) exit(5); - ctx->set_sampler_views(ctx, PIPE_SHADER_FRAGMENT, 0, 1, &sv); + ctx->set_sampler_views(ctx, PIPE_SHADER_FRAGMENT, 0, 1, 0, &sv); memset(&sampler_desc, 0, sizeof sampler_desc); diff --git a/src/gallium/tests/graw/quad-tex.c b/src/gallium/tests/graw/quad-tex.c index 474344f098b..481c37139f2 100644 --- a/src/gallium/tests/graw/quad-tex.c +++ b/src/gallium/tests/graw/quad-tex.c @@ -168,7 +168,7 @@ static void init_tex( void ) PIPE_FORMAT_B8G8R8A8_UNORM, tex2d); sv = graw_util_create_simple_sampler_view(&info, texture); - info.ctx->set_sampler_views(info.ctx, PIPE_SHADER_FRAGMENT, 0, 1, &sv); + info.ctx->set_sampler_views(info.ctx, PIPE_SHADER_FRAGMENT, 0, 1, 0, &sv); sampler = graw_util_create_simple_sampler(&info, PIPE_TEX_WRAP_REPEAT, diff --git a/src/gallium/tests/graw/tex-srgb.c b/src/gallium/tests/graw/tex-srgb.c index baa487653da..da4e40bd088 100644 --- a/src/gallium/tests/graw/tex-srgb.c +++ b/src/gallium/tests/graw/tex-srgb.c @@ -129,11 +129,11 @@ static void draw( void ) info.ctx->clear(info.ctx, PIPE_CLEAR_COLOR, NULL, &clear_color, 0, 0); - info.ctx->set_sampler_views(info.ctx, PIPE_SHADER_FRAGMENT, 0, 1, &linear_sv); + info.ctx->set_sampler_views(info.ctx, PIPE_SHADER_FRAGMENT, 0, 1, 0, &linear_sv); set_vertices(vertices1, 4); util_draw_arrays(info.ctx, PIPE_PRIM_QUADS, 0, 4); - info.ctx->set_sampler_views(info.ctx, PIPE_SHADER_FRAGMENT, 0, 1, &srgb_sv); + info.ctx->set_sampler_views(info.ctx, PIPE_SHADER_FRAGMENT, 0, 1, 0, &srgb_sv); set_vertices(vertices2, 4); util_draw_arrays(info.ctx, PIPE_PRIM_QUADS, 0, 4); diff --git a/src/gallium/tests/graw/tex-swizzle.c b/src/gallium/tests/graw/tex-swizzle.c index f21c76a4e08..c867c15219e 100644 --- a/src/gallium/tests/graw/tex-swizzle.c +++ b/src/gallium/tests/graw/tex-swizzle.c @@ -147,7 +147,7 @@ init_tex(const unsigned swizzle[4]) if (sv == NULL) exit(5); - info.ctx->set_sampler_views(info.ctx, PIPE_SHADER_FRAGMENT, 0, 1, &sv); + info.ctx->set_sampler_views(info.ctx, PIPE_SHADER_FRAGMENT, 0, 1, 0, &sv); sampler = graw_util_create_simple_sampler(&info, PIPE_TEX_WRAP_REPEAT, diff --git a/src/gallium/tests/graw/vs-test.c b/src/gallium/tests/graw/vs-test.c index 969ffe74904..94238037d1f 100644 --- a/src/gallium/tests/graw/vs-test.c +++ b/src/gallium/tests/graw/vs-test.c @@ -338,7 +338,7 @@ static void init_tex( void ) if (sv == NULL) exit(5); - ctx->set_sampler_views(ctx, PIPE_SHADER_FRAGMENT, 0, 1, &sv); + ctx->set_sampler_views(ctx, PIPE_SHADER_FRAGMENT, 0, 1, 0, &sv); memset(&sampler_desc, 0, sizeof sampler_desc); diff --git a/src/gallium/tests/trivial/compute.c b/src/gallium/tests/trivial/compute.c index 94599e92288..a1ca7f3c306 100644 --- a/src/gallium/tests/trivial/compute.c +++ b/src/gallium/tests/trivial/compute.c @@ -315,7 +315,7 @@ static void init_sampler_views(struct context *ctx, const int *slots) assert(ctx->view[i]); } - pipe->set_sampler_views(pipe, PIPE_SHADER_COMPUTE, 0, i, ctx->view); + pipe->set_sampler_views(pipe, PIPE_SHADER_COMPUTE, 0, i, 0, ctx->view); } static void destroy_sampler_views(struct context *ctx) @@ -323,7 +323,7 @@ static void destroy_sampler_views(struct context *ctx) struct pipe_context *pipe = ctx->pipe; int i; - pipe->set_sampler_views(pipe, PIPE_SHADER_COMPUTE, 0, MAX_RESOURCES, NULL); + pipe->set_sampler_views(pipe, PIPE_SHADER_COMPUTE, 0, 0, MAX_RESOURCES, NULL); for (i = 0; i < MAX_RESOURCES; ++i) { if (ctx->view[i]) { diff --git a/src/gallium/tests/trivial/quad-tex.c b/src/gallium/tests/trivial/quad-tex.c index cc4e011d7a9..563e4f35a7f 100644 --- a/src/gallium/tests/trivial/quad-tex.c +++ b/src/gallium/tests/trivial/quad-tex.c @@ -322,7 +322,7 @@ static void draw(struct program *p) cso_set_samplers(p->cso, PIPE_SHADER_FRAGMENT, 1, samplers); /* texture sampler view */ - p->pipe->set_sampler_views(p->pipe, PIPE_SHADER_FRAGMENT, 0, 1, &p->view); + p->pipe->set_sampler_views(p->pipe, PIPE_SHADER_FRAGMENT, 0, 1, 0, &p->view); /* shaders */ cso_set_fragment_shader_handle(p->cso, p->fs); diff --git a/src/mesa/state_tracker/st_atom_texture.c b/src/mesa/state_tracker/st_atom_texture.c index 2c8cf563033..117c5b5a481 100644 --- a/src/mesa/state_tracker/st_atom_texture.c +++ b/src/mesa/state_tracker/st_atom_texture.c @@ -252,7 +252,7 @@ update_textures(struct st_context *st, for (unsigned i = 0; i < num_unbind; i++) pipe_sampler_view_reference(&sampler_views[num_textures + i], NULL); - pipe->set_sampler_views(pipe, shader_stage, 0, num_textures + num_unbind, + pipe->set_sampler_views(pipe, shader_stage, 0, num_textures, num_unbind, sampler_views); st->state.num_sampler_views[shader_stage] = num_textures; } diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c index 63d8ac8dde2..92d3aef1c82 100644 --- a/src/mesa/state_tracker/st_cb_bitmap.c +++ b/src/mesa/state_tracker/st_cb_bitmap.c @@ -247,7 +247,8 @@ setup_render_state(struct gl_context *ctx, memcpy(sampler_views, st->state.frag_sampler_views, sizeof(sampler_views)); sampler_views[fpv->bitmap_sampler] = sv; - pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, num, sampler_views); + pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, num, 0, + sampler_views); st->state.num_sampler_views[PIPE_SHADER_FRAGMENT] = MAX2(st->state.num_sampler_views[PIPE_SHADER_FRAGMENT], num); } @@ -279,10 +280,9 @@ restore_render_state(struct gl_context *ctx) /* Unbind all because st/mesa won't do it if the current shader doesn't * use them. */ - static struct pipe_sampler_view *null[PIPE_MAX_SAMPLERS]; - pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, + pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, 0, st->state.num_sampler_views[PIPE_SHADER_FRAGMENT], - null); + NULL); st->state.num_sampler_views[PIPE_SHADER_FRAGMENT] = 0; st->dirty |= ST_NEW_VERTEX_ARRAYS | diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index 602b4703b9f..90619c97bf7 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -881,12 +881,14 @@ draw_textured_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z, sampler_views[fpv->drawpix_sampler] = sv[0]; if (sv[1]) sampler_views[fpv->pixelmap_sampler] = sv[1]; - pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, num, sampler_views); + pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, num, 0, + sampler_views); st->state.num_sampler_views[PIPE_SHADER_FRAGMENT] = MAX2(st->state.num_sampler_views[PIPE_SHADER_FRAGMENT], num); } else { /* drawing a depth/stencil image */ - pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, num_sampler_view, sv); + pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, num_sampler_view, + 0, sv); st->state.num_sampler_views[PIPE_SHADER_FRAGMENT] = MAX2(st->state.num_sampler_views[PIPE_SHADER_FRAGMENT], num_sampler_view); } @@ -940,10 +942,9 @@ draw_textured_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z, /* Unbind all because st/mesa won't do it if the current shader doesn't * use them. */ - static struct pipe_sampler_view *null[PIPE_MAX_SAMPLERS]; - pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, + pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, 0, st->state.num_sampler_views[PIPE_SHADER_FRAGMENT], - null); + NULL); st->state.num_sampler_views[PIPE_SHADER_FRAGMENT] = 0; st->dirty |= ST_NEW_VERTEX_ARRAYS | diff --git a/src/mesa/state_tracker/st_cb_readpixels.c b/src/mesa/state_tracker/st_cb_readpixels.c index 44bc91f0d54..3811f6e1d23 100644 --- a/src/mesa/state_tracker/st_cb_readpixels.c +++ b/src/mesa/state_tracker/st_cb_readpixels.c @@ -189,7 +189,8 @@ try_pbo_readpixels(struct st_context *st, struct st_renderbuffer *strb, if (sampler_view == NULL) goto fail; - pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, 1, &sampler_view); + pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, 1, 0, + &sampler_view); st->state.num_sampler_views[PIPE_SHADER_FRAGMENT] = MAX2(st->state.num_sampler_views[PIPE_SHADER_FRAGMENT], 1); @@ -258,10 +259,9 @@ fail: /* Unbind all because st/mesa won't do it if the current shader doesn't * use them. */ - static struct pipe_sampler_view *null[PIPE_MAX_SAMPLERS]; - pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, + pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, 0, st->state.num_sampler_views[PIPE_SHADER_FRAGMENT], - null); + NULL); st->state.num_sampler_views[PIPE_SHADER_FRAGMENT] = 0; pipe->set_shader_images(pipe, PIPE_SHADER_FRAGMENT, 0, 0, 1, NULL); diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index f20afbacdb4..67c1dc7f587 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -1312,7 +1312,8 @@ try_pbo_upload_common(struct gl_context *ctx, if (sampler_view == NULL) goto fail; - pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, 1, &sampler_view); + pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, 1, 0, + &sampler_view); st->state.num_sampler_views[PIPE_SHADER_FRAGMENT] = MAX2(st->state.num_sampler_views[PIPE_SHADER_FRAGMENT], 1); @@ -1354,10 +1355,9 @@ fail: /* Unbind all because st/mesa won't do it if the current shader doesn't * use them. */ - static struct pipe_sampler_view *null[PIPE_MAX_SAMPLERS]; - pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, + pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, 0, st->state.num_sampler_views[PIPE_SHADER_FRAGMENT], - null); + NULL); st->state.num_sampler_views[PIPE_SHADER_FRAGMENT] = 0; st->dirty |= ST_NEW_VERTEX_ARRAYS | |