diff --git a/src/gallium/auxiliary/cso_cache/cso_context.c b/src/gallium/auxiliary/cso_cache/cso_context.c index 5c84790338f..f2bb4dd54bc 100644 --- a/src/gallium/auxiliary/cso_cache/cso_context.c +++ b/src/gallium/auxiliary/cso_cache/cso_context.c @@ -1027,12 +1027,12 @@ void cso_set_vertex_buffers(struct cso_context *ctx, return; if (vbuf) { - u_vbuf_set_vertex_buffers(vbuf, start_slot, count, buffers); + u_vbuf_set_vertex_buffers(vbuf, start_slot, count, 0, buffers); return; } struct pipe_context *pipe = ctx->pipe; - pipe->set_vertex_buffers(pipe, start_slot, count, buffers); + pipe->set_vertex_buffers(pipe, start_slot, count, 0, buffers); } /** @@ -1052,8 +1052,8 @@ cso_set_vertex_buffers_and_elements(struct cso_context *ctx, const struct cso_velems_state *velems, unsigned vb_count, unsigned unbind_trailing_vb_count, - const struct pipe_vertex_buffer *vbuffers, - bool uses_user_vertex_buffers) + bool uses_user_vertex_buffers, + const struct pipe_vertex_buffer *vbuffers) { struct u_vbuf *vbuf = ctx->vbuf; struct pipe_context *pipe = ctx->pipe; @@ -1063,18 +1063,18 @@ cso_set_vertex_buffers_and_elements(struct cso_context *ctx, /* Unbind all buffers in cso_context, because we'll use u_vbuf. */ unsigned unbind_vb_count = vb_count + unbind_trailing_vb_count; if (unbind_vb_count) - pipe->set_vertex_buffers(pipe, 0, unbind_vb_count, NULL); + pipe->set_vertex_buffers(pipe, 0, 0, unbind_vb_count, NULL); /* Unset this to make sure the CSO is re-bound on the next use. */ ctx->velements = NULL; ctx->vbuf_current = vbuf; - } else if (unbind_trailing_vb_count) { - u_vbuf_set_vertex_buffers(vbuf, vb_count, unbind_trailing_vb_count, - NULL); + unbind_trailing_vb_count = 0; } - if (vb_count) - u_vbuf_set_vertex_buffers(vbuf, 0, vb_count, vbuffers); + if (vb_count || unbind_trailing_vb_count) { + u_vbuf_set_vertex_buffers(vbuf, 0, vb_count, + unbind_trailing_vb_count, vbuffers); + } u_vbuf_set_vertex_elements(vbuf, velems); return; } @@ -1083,17 +1083,18 @@ cso_set_vertex_buffers_and_elements(struct cso_context *ctx, /* Unbind all buffers in u_vbuf, because we'll use cso_context. */ unsigned unbind_vb_count = vb_count + unbind_trailing_vb_count; if (unbind_vb_count) - u_vbuf_set_vertex_buffers(vbuf, 0, unbind_vb_count, NULL); + u_vbuf_set_vertex_buffers(vbuf, 0, 0, unbind_vb_count, NULL); /* Unset this to make sure the CSO is re-bound on the next use. */ u_vbuf_unset_vertex_elements(vbuf); ctx->vbuf_current = NULL; - } else if (unbind_trailing_vb_count) { - pipe->set_vertex_buffers(pipe, vb_count, unbind_trailing_vb_count, NULL); + unbind_trailing_vb_count = 0; } - if (vb_count) - pipe->set_vertex_buffers(pipe, 0, vb_count, vbuffers); + if (vb_count || unbind_trailing_vb_count) { + pipe->set_vertex_buffers(pipe, 0, vb_count, unbind_trailing_vb_count, + vbuffers); + } cso_set_vertex_elements_direct(ctx, velems); } diff --git a/src/gallium/auxiliary/cso_cache/cso_context.h b/src/gallium/auxiliary/cso_cache/cso_context.h index dd7121663ca..cd0fc0f616e 100644 --- a/src/gallium/auxiliary/cso_cache/cso_context.h +++ b/src/gallium/auxiliary/cso_cache/cso_context.h @@ -169,8 +169,8 @@ cso_set_vertex_buffers_and_elements(struct cso_context *ctx, const struct cso_velems_state *velems, unsigned vb_count, unsigned unbind_trailing_vb_count, - const struct pipe_vertex_buffer *vbuffers, - bool uses_user_vertex_buffers); + bool uses_user_vertex_buffers, + const struct pipe_vertex_buffer *vbuffers); /* drawing */ diff --git a/src/gallium/auxiliary/draw/draw_context.c b/src/gallium/auxiliary/draw/draw_context.c index 86fa5b9d8d5..95b1b56a2f0 100644 --- a/src/gallium/auxiliary/draw/draw_context.c +++ b/src/gallium/auxiliary/draw/draw_context.c @@ -411,13 +411,15 @@ void draw_set_viewport_states( struct draw_context *draw, void draw_set_vertex_buffers(struct draw_context *draw, unsigned start_slot, unsigned count, + unsigned unbind_num_trailing_slots, const struct pipe_vertex_buffer *buffers) { assert(start_slot + count <= PIPE_MAX_ATTRIBS); util_set_vertex_buffers_count(draw->pt.vertex_buffer, &draw->pt.nr_vertex_buffers, - buffers, start_slot, count); + buffers, start_slot, count, + unbind_num_trailing_slots); } diff --git a/src/gallium/auxiliary/draw/draw_context.h b/src/gallium/auxiliary/draw/draw_context.h index 4dcc0d75624..242ffb20650 100644 --- a/src/gallium/auxiliary/draw/draw_context.h +++ b/src/gallium/auxiliary/draw/draw_context.h @@ -284,6 +284,7 @@ void draw_set_tess_state(struct draw_context *draw, void draw_set_vertex_buffers(struct draw_context *draw, unsigned start_slot, unsigned count, + unsigned unbind_num_trailing_slots, const struct pipe_vertex_buffer *buffers); void draw_set_vertex_elements(struct draw_context *draw, diff --git a/src/gallium/auxiliary/driver_ddebug/dd_context.c b/src/gallium/auxiliary/driver_ddebug/dd_context.c index febd186855e..f96fe14e3f7 100644 --- a/src/gallium/auxiliary/driver_ddebug/dd_context.c +++ b/src/gallium/auxiliary/driver_ddebug/dd_context.c @@ -553,6 +553,7 @@ dd_context_set_shader_buffers(struct pipe_context *_pipe, static void dd_context_set_vertex_buffers(struct pipe_context *_pipe, unsigned start, unsigned num_buffers, + unsigned unbind_num_trailing_slots, const struct pipe_vertex_buffer *buffers) { struct dd_context *dctx = dd_context(_pipe); @@ -560,7 +561,10 @@ dd_context_set_vertex_buffers(struct pipe_context *_pipe, safe_memcpy(&dctx->draw_state.vertex_buffers[start], buffers, sizeof(buffers[0]) * num_buffers); - pipe->set_vertex_buffers(pipe, start, num_buffers, buffers); + safe_memcpy(&dctx->draw_state.vertex_buffers[start + num_buffers], NULL, + sizeof(buffers[0]) * unbind_num_trailing_slots); + pipe->set_vertex_buffers(pipe, start, num_buffers, + unbind_num_trailing_slots, buffers); } static void diff --git a/src/gallium/auxiliary/driver_noop/noop_state.c b/src/gallium/auxiliary/driver_noop/noop_state.c index 64ba57039c7..b0315afe1e0 100644 --- a/src/gallium/auxiliary/driver_noop/noop_state.c +++ b/src/gallium/auxiliary/driver_noop/noop_state.c @@ -203,6 +203,7 @@ static void noop_delete_state(struct pipe_context *ctx, void *state) static void noop_set_vertex_buffers(struct pipe_context *ctx, unsigned start_slot, unsigned count, + unsigned unbind_num_trailing_slots, const struct pipe_vertex_buffer *buffers) { } diff --git a/src/gallium/auxiliary/driver_rbug/rbug_context.c b/src/gallium/auxiliary/driver_rbug/rbug_context.c index dedc190d93b..e0d92ff8021 100644 --- a/src/gallium/auxiliary/driver_rbug/rbug_context.c +++ b/src/gallium/auxiliary/driver_rbug/rbug_context.c @@ -774,6 +774,7 @@ rbug_set_sampler_views(struct pipe_context *_pipe, static void rbug_set_vertex_buffers(struct pipe_context *_pipe, unsigned start_slot, unsigned num_buffers, + unsigned unbind_num_trailing_slots, const struct pipe_vertex_buffer *_buffers) { struct rbug_context *rb_pipe = rbug_context(_pipe); @@ -795,7 +796,7 @@ rbug_set_vertex_buffers(struct pipe_context *_pipe, } pipe->set_vertex_buffers(pipe, start_slot, - num_buffers, + num_buffers, unbind_num_trailing_slots, buffers); 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 8ffd5bd2e81..a31da2ce13c 100644 --- a/src/gallium/auxiliary/driver_trace/tr_context.c +++ b/src/gallium/auxiliary/driver_trace/tr_context.c @@ -1021,6 +1021,7 @@ trace_context_set_sampler_views(struct pipe_context *_pipe, static void trace_context_set_vertex_buffers(struct pipe_context *_pipe, unsigned start_slot, unsigned num_buffers, + unsigned unbind_num_trailing_slots, const struct pipe_vertex_buffer *buffers) { struct trace_context *tr_ctx = trace_context(_pipe); @@ -1031,12 +1032,14 @@ trace_context_set_vertex_buffers(struct pipe_context *_pipe, trace_dump_arg(ptr, pipe); trace_dump_arg(uint, start_slot); trace_dump_arg(uint, num_buffers); + trace_dump_arg(uint, unbind_num_trailing_slots); trace_dump_arg_begin("buffers"); trace_dump_struct_array(vertex_buffer, buffers, num_buffers); trace_dump_arg_end(); - pipe->set_vertex_buffers(pipe, start_slot, num_buffers, buffers); + pipe->set_vertex_buffers(pipe, start_slot, num_buffers, + unbind_num_trailing_slots, buffers); trace_dump_call_end(); } diff --git a/src/gallium/auxiliary/hud/hud_context.c b/src/gallium/auxiliary/hud/hud_context.c index cff4586a2d6..8c2146b8a50 100644 --- a/src/gallium/auxiliary/hud/hud_context.c +++ b/src/gallium/auxiliary/hud/hud_context.c @@ -607,7 +607,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, 1, NULL); + pipe->set_vertex_buffers(pipe, 0, 0, 1, NULL); pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, 1, NULL); /* restore states not restored by cso */ diff --git a/src/gallium/auxiliary/postprocess/pp_run.c b/src/gallium/auxiliary/postprocess/pp_run.c index 8444f4356fc..882450705d4 100644 --- a/src/gallium/auxiliary/postprocess/pp_run.c +++ b/src/gallium/auxiliary/postprocess/pp_run.c @@ -190,7 +190,7 @@ pp_run(struct pp_queue_t *ppq, struct pipe_resource *in, struct pipe_context *pipe = ppq->p->pipe; 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, 1, NULL); + pipe->set_vertex_buffers(pipe, 0, 0, 1, NULL); pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, 3, NULL); /* restore states not restored by cso */ diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c index f43ae7ed85c..3d11bfe28c7 100644 --- a/src/gallium/auxiliary/util/u_blitter.c +++ b/src/gallium/auxiliary/util/u_blitter.c @@ -633,7 +633,7 @@ void util_blitter_restore_vertex_states(struct blitter_context *blitter) /* Vertex buffer. */ if (ctx->base.saved_vertex_buffer.buffer.resource) { - pipe->set_vertex_buffers(pipe, ctx->base.vb_slot, 1, + pipe->set_vertex_buffers(pipe, ctx->base.vb_slot, 1, 0, &ctx->base.saved_vertex_buffer); pipe_vertex_buffer_unreference(&ctx->base.saved_vertex_buffer); } @@ -1352,7 +1352,7 @@ static void blitter_draw(struct blitter_context_priv *ctx, return; u_upload_unmap(pipe->stream_uploader); - pipe->set_vertex_buffers(pipe, ctx->base.vb_slot, 1, &vb); + pipe->set_vertex_buffers(pipe, ctx->base.vb_slot, 1, 0, &vb); pipe->bind_vertex_elements_state(pipe, vertex_elements_cso); pipe->bind_vs_state(pipe, get_vs(&ctx->base)); @@ -2517,7 +2517,7 @@ void util_blitter_copy_buffer(struct blitter_context *blitter, vb.buffer_offset = srcx; vb.stride = 4; - pipe->set_vertex_buffers(pipe, ctx->base.vb_slot, 1, &vb); + pipe->set_vertex_buffers(pipe, ctx->base.vb_slot, 1, 0, &vb); pipe->bind_vertex_elements_state(pipe, ctx->velem_state_readbuf[0]); bind_vs_pos_only(ctx, 1); if (ctx->has_geometry_shader) @@ -2583,7 +2583,7 @@ void util_blitter_clear_buffer(struct blitter_context *blitter, blitter_check_saved_vertex_states(ctx); blitter_disable_render_cond(ctx); - pipe->set_vertex_buffers(pipe, ctx->base.vb_slot, 1, &vb); + pipe->set_vertex_buffers(pipe, ctx->base.vb_slot, 1, 0, &vb); pipe->bind_vertex_elements_state(pipe, ctx->velem_state_readbuf[num_channels-1]); bind_vs_pos_only(ctx, num_channels); diff --git a/src/gallium/auxiliary/util/u_draw_quad.c b/src/gallium/auxiliary/util/u_draw_quad.c index fe9558e6c90..c96b9a76ff5 100644 --- a/src/gallium/auxiliary/util/u_draw_quad.c +++ b/src/gallium/auxiliary/util/u_draw_quad.c @@ -64,7 +64,7 @@ util_draw_vertex_buffer(struct pipe_context *pipe, cso_set_vertex_buffers(cso, vbuf_slot, 1, &vbuffer); cso_draw_arrays(cso, prim_type, 0, num_verts); } else { - pipe->set_vertex_buffers(pipe, vbuf_slot, 1, &vbuffer); + pipe->set_vertex_buffers(pipe, vbuf_slot, 1, 0, &vbuffer); util_draw_arrays(pipe, prim_type, 0, num_verts); } } diff --git a/src/gallium/auxiliary/util/u_helpers.c b/src/gallium/auxiliary/util/u_helpers.c index 7e7b2560462..4dc1790b86b 100644 --- a/src/gallium/auxiliary/util/u_helpers.c +++ b/src/gallium/auxiliary/util/u_helpers.c @@ -45,7 +45,8 @@ void util_set_vertex_buffers_mask(struct pipe_vertex_buffer *dst, uint32_t *enabled_buffers, const struct pipe_vertex_buffer *src, - unsigned start_slot, unsigned count) + unsigned start_slot, unsigned count, + unsigned unbind_num_trailing_slots) { unsigned i; uint32_t bitmask = 0; @@ -75,6 +76,9 @@ void util_set_vertex_buffers_mask(struct pipe_vertex_buffer *dst, for (i = 0; i < count; i++) pipe_vertex_buffer_unreference(&dst[i]); } + + for (i = 0; i < unbind_num_trailing_slots; i++) + pipe_vertex_buffer_unreference(&dst[count + i]); } /** @@ -84,7 +88,8 @@ void util_set_vertex_buffers_mask(struct pipe_vertex_buffer *dst, void util_set_vertex_buffers_count(struct pipe_vertex_buffer *dst, unsigned *dst_count, const struct pipe_vertex_buffer *src, - unsigned start_slot, unsigned count) + unsigned start_slot, unsigned count, + unsigned unbind_num_trailing_slots) { unsigned i; uint32_t enabled_buffers = 0; @@ -95,7 +100,7 @@ void util_set_vertex_buffers_count(struct pipe_vertex_buffer *dst, } util_set_vertex_buffers_mask(dst, &enabled_buffers, src, start_slot, - count); + count, unbind_num_trailing_slots); *dst_count = util_last_bit(enabled_buffers); } diff --git a/src/gallium/auxiliary/util/u_helpers.h b/src/gallium/auxiliary/util/u_helpers.h index 5c83f6caaa0..feaf4f88cc0 100644 --- a/src/gallium/auxiliary/util/u_helpers.h +++ b/src/gallium/auxiliary/util/u_helpers.h @@ -40,12 +40,14 @@ extern "C" { void util_set_vertex_buffers_mask(struct pipe_vertex_buffer *dst, uint32_t *enabled_buffers, const struct pipe_vertex_buffer *src, - unsigned start_slot, unsigned count); + unsigned start_slot, unsigned count, + unsigned unbind_num_trailing_slots); void util_set_vertex_buffers_count(struct pipe_vertex_buffer *dst, unsigned *dst_count, const struct pipe_vertex_buffer *src, - unsigned start_slot, unsigned count); + unsigned start_slot, unsigned count, + unsigned unbind_num_trailing_slots); void util_set_shader_buffers_mask(struct pipe_shader_buffer *dst, uint32_t *enabled_buffers, diff --git a/src/gallium/auxiliary/util/u_threaded_context.c b/src/gallium/auxiliary/util/u_threaded_context.c index 0448e8cbc1e..3e8d0b8afd9 100644 --- a/src/gallium/auxiliary/util/u_threaded_context.c +++ b/src/gallium/auxiliary/util/u_threaded_context.c @@ -1112,7 +1112,7 @@ tc_set_shader_buffers(struct pipe_context *_pipe, struct tc_vertex_buffers { ubyte start, count; - bool unbind; + ubyte unbind_num_trailing_slots; struct pipe_vertex_buffer slot[0]; /* more will be allocated if needed */ }; @@ -1122,15 +1122,17 @@ tc_call_set_vertex_buffers(struct pipe_context *pipe, union tc_payload *payload) struct tc_vertex_buffers *p = (struct tc_vertex_buffers *)payload; unsigned count = p->count; - if (p->unbind) { - pipe->set_vertex_buffers(pipe, p->start, count, NULL); + if (!count) { + pipe->set_vertex_buffers(pipe, p->start, 0, + p->unbind_num_trailing_slots, NULL); return; } for (unsigned i = 0; i < count; i++) tc_assert(!p->slot[i].is_user_buffer); - pipe->set_vertex_buffers(pipe, p->start, count, p->slot); + pipe->set_vertex_buffers(pipe, p->start, count, + p->unbind_num_trailing_slots, p->slot); for (unsigned i = 0; i < count; i++) pipe_resource_reference(&p->slot[i].buffer.resource, NULL); } @@ -1138,19 +1140,20 @@ tc_call_set_vertex_buffers(struct pipe_context *pipe, union tc_payload *payload) static void tc_set_vertex_buffers(struct pipe_context *_pipe, unsigned start, unsigned count, + unsigned unbind_num_trailing_slots, const struct pipe_vertex_buffer *buffers) { struct threaded_context *tc = threaded_context(_pipe); - if (!count) + if (!count && !unbind_num_trailing_slots) return; - if (buffers) { + if (count && buffers) { struct tc_vertex_buffers *p = tc_add_slot_based_call(tc, TC_CALL_set_vertex_buffers, tc_vertex_buffers, count); p->start = start; p->count = count; - p->unbind = false; + p->unbind_num_trailing_slots = unbind_num_trailing_slots; for (unsigned i = 0; i < count; i++) { struct pipe_vertex_buffer *dst = &p->slot[i]; @@ -1167,8 +1170,8 @@ tc_set_vertex_buffers(struct pipe_context *_pipe, struct tc_vertex_buffers *p = tc_add_slot_based_call(tc, TC_CALL_set_vertex_buffers, tc_vertex_buffers, 0); p->start = start; - p->count = count; - p->unbind = true; + p->count = 0; + p->unbind_num_trailing_slots = count + unbind_num_trailing_slots; } } diff --git a/src/gallium/auxiliary/util/u_vbuf.c b/src/gallium/auxiliary/util/u_vbuf.c index add103df0bf..7323ed451ba 100644 --- a/src/gallium/auxiliary/util/u_vbuf.c +++ b/src/gallium/auxiliary/util/u_vbuf.c @@ -391,7 +391,7 @@ void u_vbuf_destroy(struct u_vbuf *mgr) const unsigned num_vb = screen->get_shader_param(screen, PIPE_SHADER_VERTEX, PIPE_SHADER_CAP_MAX_INPUTS); - mgr->pipe->set_vertex_buffers(mgr->pipe, 0, num_vb, NULL); + mgr->pipe->set_vertex_buffers(mgr->pipe, 0, 0, num_vb, NULL); for (i = 0; i < PIPE_MAX_ATTRIBS; i++) pipe_vertex_buffer_unreference(&mgr->vertex_buffer[i]); @@ -877,6 +877,7 @@ static void u_vbuf_delete_vertex_elements(void *ctx, void *state, void u_vbuf_set_vertex_buffers(struct u_vbuf *mgr, unsigned start_slot, unsigned count, + unsigned unbind_num_trailing_slots, const struct pipe_vertex_buffer *bufs) { unsigned i; @@ -888,7 +889,8 @@ void u_vbuf_set_vertex_buffers(struct u_vbuf *mgr, uint32_t incompatible_vb_mask = 0; /* which buffers have a non-zero stride */ uint32_t nonzero_stride_vb_mask = 0; - const uint32_t mask = ~(((1ull << count) - 1) << start_slot); + const uint32_t mask = + ~(((1ull << (count + unbind_num_trailing_slots)) - 1) << start_slot); /* Zero out the bits we are going to rewrite completely. */ mgr->user_vb_mask &= mask; @@ -899,16 +901,18 @@ void u_vbuf_set_vertex_buffers(struct u_vbuf *mgr, if (!bufs) { struct pipe_context *pipe = mgr->pipe; /* Unbind. */ + unsigned total_count = count + unbind_num_trailing_slots; mgr->dirty_real_vb_mask &= mask; - for (i = 0; i < count; i++) { + for (i = 0; i < total_count; i++) { unsigned dst_index = start_slot + i; pipe_vertex_buffer_unreference(&mgr->vertex_buffer[dst_index]); pipe_vertex_buffer_unreference(&mgr->real_vertex_buffer[dst_index]); } - pipe->set_vertex_buffers(pipe, start_slot, count, NULL); + pipe->set_vertex_buffers(pipe, start_slot, count, + unbind_num_trailing_slots, NULL); return; } @@ -953,6 +957,13 @@ void u_vbuf_set_vertex_buffers(struct u_vbuf *mgr, pipe_vertex_buffer_reference(real_vb, vb); } + for (i = 0; i < unbind_num_trailing_slots; i++) { + unsigned dst_index = start_slot + count + i; + + pipe_vertex_buffer_unreference(&mgr->vertex_buffer[dst_index]); + pipe_vertex_buffer_unreference(&mgr->real_vertex_buffer[dst_index]); + } + mgr->user_vb_mask |= user_vb_mask; mgr->incompatible_vb_mask |= incompatible_vb_mask; mgr->nonzero_stride_vb_mask |= nonzero_stride_vb_mask; @@ -1251,7 +1262,7 @@ static void u_vbuf_set_driver_vertex_buffers(struct u_vbuf *mgr) start_slot = ffs(mgr->dirty_real_vb_mask) - 1; count = util_last_bit(mgr->dirty_real_vb_mask >> start_slot); - pipe->set_vertex_buffers(pipe, start_slot, count, + pipe->set_vertex_buffers(pipe, start_slot, count, 0, mgr->real_vertex_buffer + start_slot); mgr->dirty_real_vb_mask = 0; } diff --git a/src/gallium/auxiliary/util/u_vbuf.h b/src/gallium/auxiliary/util/u_vbuf.h index 3df24030872..82188236766 100644 --- a/src/gallium/auxiliary/util/u_vbuf.h +++ b/src/gallium/auxiliary/util/u_vbuf.h @@ -76,6 +76,7 @@ void u_vbuf_set_vertex_elements(struct u_vbuf *mgr, void u_vbuf_unset_vertex_elements(struct u_vbuf *mgr); void u_vbuf_set_vertex_buffers(struct u_vbuf *mgr, unsigned start_slot, unsigned count, + unsigned unbind_num_trailing_slots, const struct pipe_vertex_buffer *bufs); void u_vbuf_draw_vbo(struct u_vbuf *mgr, const struct pipe_draw_info *info, const struct pipe_draw_indirect_info *indirect, diff --git a/src/gallium/auxiliary/vl/vl_bicubic_filter.c b/src/gallium/auxiliary/vl/vl_bicubic_filter.c index 81cbf9c9d52..d6e128a4440 100644 --- a/src/gallium/auxiliary/vl/vl_bicubic_filter.c +++ b/src/gallium/auxiliary/vl/vl_bicubic_filter.c @@ -457,7 +457,7 @@ vl_bicubic_filter_render(struct vl_bicubic_filter *filter, filter->pipe->bind_fs_state(filter->pipe, filter->fs); filter->pipe->set_framebuffer_state(filter->pipe, &fb_state); filter->pipe->set_viewport_states(filter->pipe, 0, 1, &viewport); - filter->pipe->set_vertex_buffers(filter->pipe, 0, 1, &filter->quad); + filter->pipe->set_vertex_buffers(filter->pipe, 0, 1, 0, &filter->quad); filter->pipe->bind_vertex_elements_state(filter->pipe, filter->ves); util_draw_arrays(filter->pipe, PIPE_PRIM_QUADS, 0, 4); diff --git a/src/gallium/auxiliary/vl/vl_compositor_gfx.c b/src/gallium/auxiliary/vl/vl_compositor_gfx.c index 62db005432e..b1a6d2027b1 100644 --- a/src/gallium/auxiliary/vl/vl_compositor_gfx.c +++ b/src/gallium/auxiliary/vl/vl_compositor_gfx.c @@ -717,7 +717,7 @@ vl_compositor_gfx_render(struct vl_compositor_state *s, c->pipe->set_framebuffer_state(c->pipe, &c->fb_state); c->pipe->bind_vs_state(c->pipe, c->vs); - c->pipe->set_vertex_buffers(c->pipe, 0, 1, &c->vertex_buf); + c->pipe->set_vertex_buffers(c->pipe, 0, 1, 0, &c->vertex_buf); c->pipe->bind_vertex_elements_state(c->pipe, c->vertex_elems_state); pipe_set_constant_buffer(c->pipe, PIPE_SHADER_FRAGMENT, 0, s->shader_params); c->pipe->bind_rasterizer_state(c->pipe, c->rast); diff --git a/src/gallium/auxiliary/vl/vl_deint_filter.c b/src/gallium/auxiliary/vl/vl_deint_filter.c index 1b8dad59a1f..3754e00370c 100644 --- a/src/gallium/auxiliary/vl/vl_deint_filter.c +++ b/src/gallium/auxiliary/vl/vl_deint_filter.c @@ -463,7 +463,7 @@ vl_deint_filter_render(struct vl_deint_filter *filter, /* set up pipe state */ filter->pipe->bind_rasterizer_state(filter->pipe, filter->rs_state); - filter->pipe->set_vertex_buffers(filter->pipe, 0, 1, &filter->quad); + filter->pipe->set_vertex_buffers(filter->pipe, 0, 1, 0, &filter->quad); filter->pipe->bind_vertex_elements_state(filter->pipe, filter->ves); filter->pipe->bind_vs_state(filter->pipe, filter->vs); filter->pipe->bind_sampler_states(filter->pipe, PIPE_SHADER_FRAGMENT, diff --git a/src/gallium/auxiliary/vl/vl_matrix_filter.c b/src/gallium/auxiliary/vl/vl_matrix_filter.c index 4a24c6a3f97..bbc09bfeb31 100644 --- a/src/gallium/auxiliary/vl/vl_matrix_filter.c +++ b/src/gallium/auxiliary/vl/vl_matrix_filter.c @@ -296,7 +296,7 @@ vl_matrix_filter_render(struct vl_matrix_filter *filter, filter->pipe->bind_fs_state(filter->pipe, filter->fs); filter->pipe->set_framebuffer_state(filter->pipe, &fb_state); filter->pipe->set_viewport_states(filter->pipe, 0, 1, &viewport); - filter->pipe->set_vertex_buffers(filter->pipe, 0, 1, &filter->quad); + filter->pipe->set_vertex_buffers(filter->pipe, 0, 1, 0, &filter->quad); filter->pipe->bind_vertex_elements_state(filter->pipe, filter->ves); util_draw_arrays(filter->pipe, PIPE_PRIM_QUADS, 0, 4); diff --git a/src/gallium/auxiliary/vl/vl_median_filter.c b/src/gallium/auxiliary/vl/vl_median_filter.c index b10237d1e56..6b69295bd7e 100644 --- a/src/gallium/auxiliary/vl/vl_median_filter.c +++ b/src/gallium/auxiliary/vl/vl_median_filter.c @@ -400,7 +400,7 @@ vl_median_filter_render(struct vl_median_filter *filter, filter->pipe->bind_fs_state(filter->pipe, filter->fs); filter->pipe->set_framebuffer_state(filter->pipe, &fb_state); filter->pipe->set_viewport_states(filter->pipe, 0, 1, &viewport); - filter->pipe->set_vertex_buffers(filter->pipe, 0, 1, &filter->quad); + filter->pipe->set_vertex_buffers(filter->pipe, 0, 1, 0, &filter->quad); filter->pipe->bind_vertex_elements_state(filter->pipe, filter->ves); util_draw_arrays(filter->pipe, PIPE_PRIM_QUADS, 0, 4); diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c b/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c index 7eb67080c3b..7a617d3498b 100644 --- a/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c +++ b/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c @@ -794,7 +794,7 @@ vl_mpeg12_end_frame(struct pipe_video_codec *decoder, if (!ref_frames[j] || !ref_frames[j][i]) continue; vb[2] = vl_vb_get_mv(&buf->vertex_stream, j); - dec->context->set_vertex_buffers(dec->context, 0, 3, vb); + dec->context->set_vertex_buffers(dec->context, 0, 3, 0, vb); vl_mc_render_ref(i ? &dec->mc_c : &dec->mc_y, &buf->mc[i], ref_frames[j][i]); } @@ -805,7 +805,7 @@ vl_mpeg12_end_frame(struct pipe_video_codec *decoder, if (!buf->num_ycbcr_blocks[i]) continue; vb[1] = vl_vb_get_ycbcr(&buf->vertex_stream, i); - dec->context->set_vertex_buffers(dec->context, 0, 2, vb); + dec->context->set_vertex_buffers(dec->context, 0, 2, 0, vb); vl_zscan_render(i ? &dec->zscan_c : & dec->zscan_y, &buf->zscan[i] , buf->num_ycbcr_blocks[i]); @@ -824,7 +824,7 @@ vl_mpeg12_end_frame(struct pipe_video_codec *decoder, if (!buf->num_ycbcr_blocks[plane]) continue; vb[1] = vl_vb_get_ycbcr(&buf->vertex_stream, plane); - dec->context->set_vertex_buffers(dec->context, 0, 2, vb); + dec->context->set_vertex_buffers(dec->context, 0, 2, 0, vb); if (dec->base.entrypoint <= PIPE_VIDEO_ENTRYPOINT_IDCT) vl_idct_prepare_stage2(i ? &dec->idct_c : &dec->idct_y, &buf->idct[plane]); diff --git a/src/gallium/drivers/d3d12/d3d12_context.cpp b/src/gallium/drivers/d3d12/d3d12_context.cpp index 6f244bc68d8..f288746fde2 100644 --- a/src/gallium/drivers/d3d12/d3d12_context.cpp +++ b/src/gallium/drivers/d3d12/d3d12_context.cpp @@ -1118,11 +1118,13 @@ static void d3d12_set_vertex_buffers(struct pipe_context *pctx, unsigned start_slot, unsigned num_buffers, + unsigned unbind_num_trailing_slots, const struct pipe_vertex_buffer *buffers) { struct d3d12_context *ctx = d3d12_context(pctx); util_set_vertex_buffers_count(ctx->vbs, &ctx->num_vbs, - buffers, start_slot, num_buffers); + buffers, start_slot, num_buffers, + unbind_num_trailing_slots); for (unsigned i = 0; i < ctx->num_vbs; ++i) { const struct pipe_vertex_buffer* buf = ctx->vbs + i; diff --git a/src/gallium/drivers/etnaviv/etnaviv_state.c b/src/gallium/drivers/etnaviv/etnaviv_state.c index 81be5b323d3..c63b7f5e546 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_state.c +++ b/src/gallium/drivers/etnaviv/etnaviv_state.c @@ -426,12 +426,14 @@ etna_set_viewport_states(struct pipe_context *pctx, unsigned start_slot, static void etna_set_vertex_buffers(struct pipe_context *pctx, unsigned start_slot, - unsigned num_buffers, const struct pipe_vertex_buffer *vb) + unsigned num_buffers, unsigned unbind_num_trailing_slots, + const struct pipe_vertex_buffer *vb) { struct etna_context *ctx = etna_context(pctx); struct etna_vertexbuf_state *so = &ctx->vertex_buffer; - util_set_vertex_buffers_mask(so->vb, &so->enabled_mask, vb, start_slot, num_buffers); + util_set_vertex_buffers_mask(so->vb, &so->enabled_mask, vb, start_slot, + num_buffers, unbind_num_trailing_slots); so->count = util_last_bit(so->enabled_mask); for (unsigned idx = start_slot; idx < start_slot + num_buffers; ++idx) { diff --git a/src/gallium/drivers/freedreno/freedreno_blitter.c b/src/gallium/drivers/freedreno/freedreno_blitter.c index 06f5b189f75..99e6773ca6f 100644 --- a/src/gallium/drivers/freedreno/freedreno_blitter.c +++ b/src/gallium/drivers/freedreno/freedreno_blitter.c @@ -219,7 +219,7 @@ fd_blitter_clear(struct pipe_context *pctx, unsigned buffers, pctx->set_viewport_states(pctx, 0, 1, &vp); pctx->bind_vertex_elements_state(pctx, ctx->solid_vbuf_state.vtx); - pctx->set_vertex_buffers(pctx, blitter->vb_slot, 1, + pctx->set_vertex_buffers(pctx, blitter->vb_slot, 1, 0, &ctx->solid_vbuf_state.vertexbuf.vb[0]); pctx->set_stream_output_targets(pctx, 0, NULL, NULL); diff --git a/src/gallium/drivers/freedreno/freedreno_state.c b/src/gallium/drivers/freedreno/freedreno_state.c index d907e8b631d..cc7fb180a1f 100644 --- a/src/gallium/drivers/freedreno/freedreno_state.c +++ b/src/gallium/drivers/freedreno/freedreno_state.c @@ -340,6 +340,7 @@ fd_set_viewport_states(struct pipe_context *pctx, static void fd_set_vertex_buffers(struct pipe_context *pctx, unsigned start_slot, unsigned count, + unsigned unbind_num_trailing_slots, const struct pipe_vertex_buffer *vb) { struct fd_context *ctx = fd_context(pctx); @@ -363,7 +364,8 @@ fd_set_vertex_buffers(struct pipe_context *pctx, } } - util_set_vertex_buffers_mask(so->vb, &so->enabled_mask, vb, start_slot, count); + util_set_vertex_buffers_mask(so->vb, &so->enabled_mask, vb, start_slot, + count, unbind_num_trailing_slots); so->count = util_last_bit(so->enabled_mask); if (!vb) diff --git a/src/gallium/drivers/i915/i915_state.c b/src/gallium/drivers/i915/i915_state.c index ddc5d631039..f7da9f53d4e 100644 --- a/src/gallium/drivers/i915/i915_state.c +++ b/src/gallium/drivers/i915/i915_state.c @@ -1007,6 +1007,7 @@ static void i915_delete_rasterizer_state(struct pipe_context *pipe, static void i915_set_vertex_buffers(struct pipe_context *pipe, unsigned start_slot, unsigned count, + unsigned unbind_num_trailing_slots, const struct pipe_vertex_buffer *buffers) { struct i915_context *i915 = i915_context(pipe); @@ -1014,10 +1015,12 @@ static void i915_set_vertex_buffers(struct pipe_context *pipe, util_set_vertex_buffers_count(i915->vertex_buffers, &i915->nr_vertex_buffers, - buffers, start_slot, count); + buffers, start_slot, count, + unbind_num_trailing_slots); /* pass-through to draw module */ - draw_set_vertex_buffers(draw, start_slot, count, buffers); + draw_set_vertex_buffers(draw, start_slot, count, + unbind_num_trailing_slots, buffers); } static void * diff --git a/src/gallium/drivers/iris/iris_state.c b/src/gallium/drivers/iris/iris_state.c index 8fe6e512828..26bb12dd084 100644 --- a/src/gallium/drivers/iris/iris_state.c +++ b/src/gallium/drivers/iris/iris_state.c @@ -3421,6 +3421,7 @@ iris_delete_state(struct pipe_context *ctx, void *state) static void iris_set_vertex_buffers(struct pipe_context *ctx, unsigned start_slot, unsigned count, + unsigned unbind_num_trailing_slots, const struct pipe_vertex_buffer *buffers) { struct iris_context *ice = (struct iris_context *) ctx; @@ -3468,6 +3469,13 @@ iris_set_vertex_buffers(struct pipe_context *ctx, } } + for (unsigned i = 0; i < unbind_num_trailing_slots; i++) { + struct iris_vertex_buffer_state *state = + &genx->vertex_buffers[start_slot + count + i]; + + pipe_resource_reference(&state->resource, NULL); + } + ice->state.dirty |= IRIS_DIRTY_VERTEX_BUFFERS; } diff --git a/src/gallium/drivers/lima/lima_state.c b/src/gallium/drivers/lima/lima_state.c index 92c63fe1132..e7d682a4e2a 100644 --- a/src/gallium/drivers/lima/lima_state.c +++ b/src/gallium/drivers/lima/lima_state.c @@ -184,13 +184,15 @@ lima_delete_vertex_elements_state(struct pipe_context *pctx, void *hwcso) static void lima_set_vertex_buffers(struct pipe_context *pctx, unsigned start_slot, unsigned count, + unsigned unbind_num_trailing_slots, const struct pipe_vertex_buffer *vb) { struct lima_context *ctx = lima_context(pctx); struct lima_context_vertex_buffer *so = &ctx->vertex_buffers; util_set_vertex_buffers_mask(so->vb, &so->enabled_mask, - vb, start_slot, count); + vb, start_slot, count, + unbind_num_trailing_slots); so->count = util_last_bit(so->enabled_mask); ctx->dirty |= LIMA_CONTEXT_DIRTY_VERTEX_BUFF; @@ -445,7 +447,7 @@ lima_state_fini(struct lima_context *ctx) struct lima_context_vertex_buffer *so = &ctx->vertex_buffers; util_set_vertex_buffers_mask(so->vb, &so->enabled_mask, NULL, - 0, ARRAY_SIZE(so->vb)); + 0, 0, ARRAY_SIZE(so->vb)); pipe_surface_reference(&ctx->framebuffer.base.cbufs[0], NULL); pipe_surface_reference(&ctx->framebuffer.base.zsbuf, NULL); diff --git a/src/gallium/drivers/llvmpipe/lp_state_vertex.c b/src/gallium/drivers/llvmpipe/lp_state_vertex.c index 702ecf96a9e..fa68872bf7e 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_vertex.c +++ b/src/gallium/drivers/llvmpipe/lp_state_vertex.c @@ -77,6 +77,7 @@ llvmpipe_delete_vertex_elements_state(struct pipe_context *pipe, void *velems) static void llvmpipe_set_vertex_buffers(struct pipe_context *pipe, unsigned start_slot, unsigned count, + unsigned unbind_num_trailing_slots, const struct pipe_vertex_buffer *buffers) { struct llvmpipe_context *llvmpipe = llvmpipe_context(pipe); @@ -85,11 +86,13 @@ llvmpipe_set_vertex_buffers(struct pipe_context *pipe, util_set_vertex_buffers_count(llvmpipe->vertex_buffer, &llvmpipe->num_vertex_buffers, - buffers, start_slot, count); + buffers, start_slot, count, + unbind_num_trailing_slots); llvmpipe->dirty |= LP_NEW_VERTEX; - draw_set_vertex_buffers(llvmpipe->draw, start_slot, count, buffers); + draw_set_vertex_buffers(llvmpipe->draw, start_slot, count, + unbind_num_trailing_slots, buffers); } diff --git a/src/gallium/drivers/nouveau/nv30/nv30_draw.c b/src/gallium/drivers/nouveau/nv30/nv30_draw.c index ce4e1911d77..f9b867745b2 100644 --- a/src/gallium/drivers/nouveau/nv30/nv30_draw.c +++ b/src/gallium/drivers/nouveau/nv30/nv30_draw.c @@ -394,7 +394,7 @@ nv30_render_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info, if (nv30->draw_dirty & NV30_NEW_CLIP) draw_set_clip_state(draw, &nv30->clip); if (nv30->draw_dirty & NV30_NEW_ARRAYS) { - draw_set_vertex_buffers(draw, 0, nv30->num_vtxbufs, nv30->vtxbuf); + draw_set_vertex_buffers(draw, 0, nv30->num_vtxbufs, 0, nv30->vtxbuf); draw_set_vertex_elements(draw, nv30->vertex->num_elements, nv30->vertex->pipe); } if (nv30->draw_dirty & NV30_NEW_FRAGPROG) { diff --git a/src/gallium/drivers/nouveau/nv30/nv30_state.c b/src/gallium/drivers/nouveau/nv30/nv30_state.c index 4123e3f551b..d22b91ff285 100644 --- a/src/gallium/drivers/nouveau/nv30/nv30_state.c +++ b/src/gallium/drivers/nouveau/nv30/nv30_state.c @@ -437,6 +437,7 @@ nv30_set_viewport_states(struct pipe_context *pipe, static void nv30_set_vertex_buffers(struct pipe_context *pipe, unsigned start_slot, unsigned count, + unsigned unbind_num_trailing_slots, const struct pipe_vertex_buffer *vb) { struct nv30_context *nv30 = nv30_context(pipe); @@ -444,7 +445,8 @@ nv30_set_vertex_buffers(struct pipe_context *pipe, nouveau_bufctx_reset(nv30->bufctx, BUFCTX_VTXBUF); util_set_vertex_buffers_count(nv30->vtxbuf, &nv30->num_vtxbufs, - vb, start_slot, count); + vb, start_slot, count, + unbind_num_trailing_slots); nv30->dirty |= NV30_NEW_ARRAYS; } diff --git a/src/gallium/drivers/nouveau/nv50/nv50_state.c b/src/gallium/drivers/nouveau/nv50/nv50_state.c index c774ecc893d..f3d67bdc5ba 100644 --- a/src/gallium/drivers/nouveau/nv50/nv50_state.c +++ b/src/gallium/drivers/nouveau/nv50/nv50_state.c @@ -1075,6 +1075,7 @@ nv50_set_window_rectangles(struct pipe_context *pipe, static void nv50_set_vertex_buffers(struct pipe_context *pipe, unsigned start_slot, unsigned count, + unsigned unbind_num_trailing_slots, const struct pipe_vertex_buffer *vb) { struct nv50_context *nv50 = nv50_context(pipe); @@ -1084,7 +1085,8 @@ nv50_set_vertex_buffers(struct pipe_context *pipe, nv50->dirty_3d |= NV50_NEW_3D_ARRAYS; util_set_vertex_buffers_count(nv50->vtxbuf, &nv50->num_vtxbufs, vb, - start_slot, count); + start_slot, count, + unbind_num_trailing_slots); if (!vb) { nv50->vbo_user &= ~(((1ull << count) - 1) << start_slot); diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_state.c b/src/gallium/drivers/nouveau/nvc0/nvc0_state.c index a3a9fd1454f..e8afe654776 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_state.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_state.c @@ -996,6 +996,7 @@ nvc0_set_tess_state(struct pipe_context *pipe, static void nvc0_set_vertex_buffers(struct pipe_context *pipe, unsigned start_slot, unsigned count, + unsigned unbind_num_trailing_slots, const struct pipe_vertex_buffer *vb) { struct nvc0_context *nvc0 = nvc0_context(pipe); @@ -1005,7 +1006,8 @@ nvc0_set_vertex_buffers(struct pipe_context *pipe, nvc0->dirty_3d |= NVC0_NEW_3D_ARRAYS; util_set_vertex_buffers_count(nvc0->vtxbuf, &nvc0->num_vtxbufs, vb, - start_slot, count); + start_slot, count, + unbind_num_trailing_slots); if (!vb) { nvc0->vbo_user &= ~(((1ull << count) - 1) << start_slot); diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c index 6dac66b81bb..d8cba2d5438 100644 --- a/src/gallium/drivers/panfrost/pan_context.c +++ b/src/gallium/drivers/panfrost/pan_context.c @@ -1008,11 +1008,13 @@ panfrost_set_vertex_buffers( struct pipe_context *pctx, unsigned start_slot, unsigned num_buffers, + unsigned unbind_num_trailing_slots, const struct pipe_vertex_buffer *buffers) { struct panfrost_context *ctx = pan_context(pctx); - util_set_vertex_buffers_mask(ctx->vertex_buffers, &ctx->vb_mask, buffers, start_slot, num_buffers); + util_set_vertex_buffers_mask(ctx->vertex_buffers, &ctx->vb_mask, buffers, + start_slot, num_buffers, unbind_num_trailing_slots); } static void diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c index 6ca434348be..3583347ce5f 100644 --- a/src/gallium/drivers/r300/r300_context.c +++ b/src/gallium/drivers/r300/r300_context.c @@ -471,7 +471,7 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen, vb.depth0 = 1; r300->dummy_vb.buffer.resource = screen->resource_create(screen, &vb); - r300->context.set_vertex_buffers(&r300->context, 0, 1, &r300->dummy_vb); + r300->context.set_vertex_buffers(&r300->context, 0, 1, 0, &r300->dummy_vb); } { diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index f62e945659b..9049c30ce7c 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -1732,19 +1732,21 @@ static void r300_set_viewport_states(struct pipe_context* pipe, static void r300_set_vertex_buffers_hwtcl(struct pipe_context* pipe, unsigned start_slot, unsigned count, + unsigned unbind_num_trailing_slots, const struct pipe_vertex_buffer* buffers) { struct r300_context* r300 = r300_context(pipe); util_set_vertex_buffers_count(r300->vertex_buffer, &r300->nr_vertex_buffers, - buffers, start_slot, count); + buffers, start_slot, count, + unbind_num_trailing_slots); /* There must be at least one vertex buffer set, otherwise it locks up. */ if (!r300->nr_vertex_buffers) { util_set_vertex_buffers_count(r300->vertex_buffer, &r300->nr_vertex_buffers, - &r300->dummy_vb, 0, 1); + &r300->dummy_vb, 0, 1, 0); } r300->vertex_arrays_dirty = TRUE; @@ -1752,6 +1754,7 @@ static void r300_set_vertex_buffers_hwtcl(struct pipe_context* pipe, static void r300_set_vertex_buffers_swtcl(struct pipe_context* pipe, unsigned start_slot, unsigned count, + unsigned unbind_num_trailing_slots, const struct pipe_vertex_buffer* buffers) { struct r300_context* r300 = r300_context(pipe); @@ -1759,8 +1762,10 @@ static void r300_set_vertex_buffers_swtcl(struct pipe_context* pipe, util_set_vertex_buffers_count(r300->vertex_buffer, &r300->nr_vertex_buffers, - buffers, start_slot, count); - draw_set_vertex_buffers(r300->draw, start_slot, count, buffers); + buffers, start_slot, count, + unbind_num_trailing_slots); + draw_set_vertex_buffers(r300->draw, start_slot, count, + unbind_num_trailing_slots, buffers); if (!buffers) return; diff --git a/src/gallium/drivers/r600/r600_pipe_common.c b/src/gallium/drivers/r600/r600_pipe_common.c index 2427c035c2b..549dc7f3dc9 100644 --- a/src/gallium/drivers/r600/r600_pipe_common.c +++ b/src/gallium/drivers/r600/r600_pipe_common.c @@ -207,7 +207,7 @@ void r600_draw_rectangle(struct blitter_context *blitter, vbuffer.stride = 2 * 4 * sizeof(float); /* vertex size */ vbuffer.buffer_offset = offset; - rctx->b.set_vertex_buffers(&rctx->b, blitter->vb_slot, 1, &vbuffer); + rctx->b.set_vertex_buffers(&rctx->b, blitter->vb_slot, 1, 0, &vbuffer); util_draw_arrays_instanced(&rctx->b, R600_PRIM_RECTANGLE_LIST, 0, 3, 0, num_instances); pipe_resource_reference(&buf, NULL); diff --git a/src/gallium/drivers/r600/r600_state_common.c b/src/gallium/drivers/r600/r600_state_common.c index 79ffbd556bf..ce4e784b412 100644 --- a/src/gallium/drivers/r600/r600_state_common.c +++ b/src/gallium/drivers/r600/r600_state_common.c @@ -566,6 +566,7 @@ void r600_vertex_buffers_dirty(struct r600_context *rctx) static void r600_set_vertex_buffers(struct pipe_context *ctx, unsigned start_slot, unsigned count, + unsigned unbind_num_trailing_slots, const struct pipe_vertex_buffer *input) { struct r600_context *rctx = (struct r600_context *)ctx; @@ -602,6 +603,11 @@ static void r600_set_vertex_buffers(struct pipe_context *ctx, disable_mask = ((1ull << count) - 1); } + for (i = 0; i < unbind_num_trailing_slots; i++) { + pipe_resource_reference(&vb[count + i].buffer.resource, NULL); + } + disable_mask |= ((1ull << unbind_num_trailing_slots) - 1) << count; + disable_mask <<= start_slot; new_buffer_mask <<= start_slot; diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c index 4000fa8c29e..6e889f54e13 100644 --- a/src/gallium/drivers/radeonsi/si_state.c +++ b/src/gallium/drivers/radeonsi/si_state.c @@ -4829,16 +4829,17 @@ static void si_delete_vertex_element(struct pipe_context *ctx, void *state) } static void si_set_vertex_buffers(struct pipe_context *ctx, unsigned start_slot, unsigned count, + unsigned unbind_num_trailing_slots, const struct pipe_vertex_buffer *buffers) { struct si_context *sctx = (struct si_context *)ctx; struct pipe_vertex_buffer *dst = sctx->vertex_buffer + start_slot; - unsigned updated_mask = u_bit_consecutive(start_slot, count); + unsigned updated_mask = u_bit_consecutive(start_slot, count + unbind_num_trailing_slots); uint32_t orig_unaligned = sctx->vertex_buffer_unaligned; uint32_t unaligned = 0; int i; - assert(start_slot + count <= ARRAY_SIZE(sctx->vertex_buffer)); + assert(start_slot + count + unbind_num_trailing_slots <= ARRAY_SIZE(sctx->vertex_buffer)); if (buffers) { for (i = 0; i < count; i++) { @@ -4863,6 +4864,9 @@ static void si_set_vertex_buffers(struct pipe_context *ctx, unsigned start_slot, pipe_resource_reference(&dst[i].buffer.resource, NULL); } + for (i = 0; i < unbind_num_trailing_slots; i++) + pipe_resource_reference(&dst[count + i].buffer.resource, NULL); + sctx->vertex_buffers_dirty = sctx->num_vertex_elements > 0; sctx->vertex_buffer_unaligned = (orig_unaligned & ~updated_mask) | unaligned; diff --git a/src/gallium/drivers/softpipe/sp_state_vertex.c b/src/gallium/drivers/softpipe/sp_state_vertex.c index a7a8736390d..6ba43c4599c 100644 --- a/src/gallium/drivers/softpipe/sp_state_vertex.c +++ b/src/gallium/drivers/softpipe/sp_state_vertex.c @@ -81,6 +81,7 @@ softpipe_delete_vertex_elements_state(struct pipe_context *pipe, void *velems) static void softpipe_set_vertex_buffers(struct pipe_context *pipe, unsigned start_slot, unsigned count, + unsigned unbind_num_trailing_slots, const struct pipe_vertex_buffer *buffers) { struct softpipe_context *softpipe = softpipe_context(pipe); @@ -89,11 +90,13 @@ softpipe_set_vertex_buffers(struct pipe_context *pipe, util_set_vertex_buffers_count(softpipe->vertex_buffer, &softpipe->num_vertex_buffers, - buffers, start_slot, count); + buffers, start_slot, count, + unbind_num_trailing_slots); softpipe->dirty |= SP_NEW_VERTEX; - draw_set_vertex_buffers(softpipe->draw, start_slot, count, buffers); + draw_set_vertex_buffers(softpipe->draw, start_slot, count, + unbind_num_trailing_slots, buffers); } diff --git a/src/gallium/drivers/svga/svga_pipe_vertex.c b/src/gallium/drivers/svga/svga_pipe_vertex.c index cd38dab6ca5..603e3909cd7 100644 --- a/src/gallium/drivers/svga/svga_pipe_vertex.c +++ b/src/gallium/drivers/svga/svga_pipe_vertex.c @@ -43,13 +43,15 @@ static void svga_set_vertex_buffers(struct pipe_context *pipe, unsigned start_slot, unsigned count, + unsigned unbind_num_trailing_slots, const struct pipe_vertex_buffer *buffers) { struct svga_context *svga = svga_context(pipe); util_set_vertex_buffers_count(svga->curr.vb, &svga->curr.num_vertex_buffers, - buffers, start_slot, count); + buffers, start_slot, count, + unbind_num_trailing_slots); svga->dirty |= SVGA_NEW_VBUFFER; } diff --git a/src/gallium/drivers/svga/svga_swtnl_state.c b/src/gallium/drivers/svga/svga_swtnl_state.c index 789ed23e88b..4f98416364c 100644 --- a/src/gallium/drivers/svga/svga_swtnl_state.c +++ b/src/gallium/drivers/svga/svga_swtnl_state.c @@ -114,7 +114,7 @@ update_swtnl_draw(struct svga_context *svga, uint64_t dirty) if (dirty & SVGA_NEW_VBUFFER) draw_set_vertex_buffers(svga->swtnl.draw, 0, - svga->curr.num_vertex_buffers, + svga->curr.num_vertex_buffers, 0, svga->curr.vb); if (dirty & SVGA_NEW_VELEMENT) diff --git a/src/gallium/drivers/swr/swr_state.cpp b/src/gallium/drivers/swr/swr_state.cpp index f3ab8253f29..3089baf9ef5 100644 --- a/src/gallium/drivers/swr/swr_state.cpp +++ b/src/gallium/drivers/swr/swr_state.cpp @@ -664,6 +664,7 @@ static void swr_set_vertex_buffers(struct pipe_context *pipe, unsigned start_slot, unsigned num_elements, + unsigned unbind_num_trailing_slots, const struct pipe_vertex_buffer *buffers) { struct swr_context *ctx = swr_context(pipe); @@ -674,7 +675,8 @@ swr_set_vertex_buffers(struct pipe_context *pipe, &ctx->num_vertex_buffers, buffers, start_slot, - num_elements); + num_elements, + unbind_num_trailing_slots); ctx->dirty |= SWR_NEW_VERTEX; } diff --git a/src/gallium/drivers/tegra/tegra_context.c b/src/gallium/drivers/tegra/tegra_context.c index 96e022c93ff..98e84a58ce0 100644 --- a/src/gallium/drivers/tegra/tegra_context.c +++ b/src/gallium/drivers/tegra/tegra_context.c @@ -622,7 +622,7 @@ tegra_set_shader_images(struct pipe_context *pcontext, unsigned int shader, static void tegra_set_vertex_buffers(struct pipe_context *pcontext, unsigned start_slot, - unsigned num_buffers, + unsigned num_buffers, unsigned unbind_num_trailing_slots, const struct pipe_vertex_buffer *buffers) { struct tegra_context *context = to_tegra_context(pcontext); @@ -641,7 +641,7 @@ tegra_set_vertex_buffers(struct pipe_context *pcontext, unsigned start_slot, } context->gpu->set_vertex_buffers(context->gpu, start_slot, num_buffers, - buffers); + unbind_num_trailing_slots, buffers); } static struct pipe_stream_output_target * diff --git a/src/gallium/drivers/v3d/v3dx_state.c b/src/gallium/drivers/v3d/v3dx_state.c index 38b300180d5..aa0315693aa 100644 --- a/src/gallium/drivers/v3d/v3dx_state.c +++ b/src/gallium/drivers/v3d/v3dx_state.c @@ -290,13 +290,15 @@ v3d_set_viewport_states(struct pipe_context *pctx, static void v3d_set_vertex_buffers(struct pipe_context *pctx, unsigned start_slot, unsigned count, + unsigned unbind_num_trailing_slots, const struct pipe_vertex_buffer *vb) { struct v3d_context *v3d = v3d_context(pctx); struct v3d_vertexbuf_stateobj *so = &v3d->vertexbuf; util_set_vertex_buffers_mask(so->vb, &so->enabled_mask, vb, - start_slot, count); + start_slot, count, + unbind_num_trailing_slots); so->count = util_last_bit(so->enabled_mask); v3d->dirty |= VC5_DIRTY_VTXBUF; diff --git a/src/gallium/drivers/vc4/vc4_state.c b/src/gallium/drivers/vc4/vc4_state.c index 4f0e8345698..3c174185502 100644 --- a/src/gallium/drivers/vc4/vc4_state.c +++ b/src/gallium/drivers/vc4/vc4_state.c @@ -313,13 +313,15 @@ vc4_set_viewport_states(struct pipe_context *pctx, static void vc4_set_vertex_buffers(struct pipe_context *pctx, unsigned start_slot, unsigned count, + unsigned unbind_num_trailing_slots, const struct pipe_vertex_buffer *vb) { struct vc4_context *vc4 = vc4_context(pctx); struct vc4_vertexbuf_stateobj *so = &vc4->vertexbuf; util_set_vertex_buffers_mask(so->vb, &so->enabled_mask, vb, - start_slot, count); + start_slot, count, + unbind_num_trailing_slots); so->count = util_last_bit(so->enabled_mask); vc4->dirty |= VC4_DIRTY_VTXBUF; diff --git a/src/gallium/drivers/virgl/virgl_context.c b/src/gallium/drivers/virgl/virgl_context.c index 2db3a13ca11..72c4a412975 100644 --- a/src/gallium/drivers/virgl/virgl_context.c +++ b/src/gallium/drivers/virgl/virgl_context.c @@ -569,13 +569,15 @@ static void virgl_bind_vertex_elements_state(struct pipe_context *ctx, static void virgl_set_vertex_buffers(struct pipe_context *ctx, unsigned start_slot, unsigned num_buffers, + unsigned unbind_num_trailing_slots, const struct pipe_vertex_buffer *buffers) { struct virgl_context *vctx = virgl_context(ctx); util_set_vertex_buffers_count(vctx->vertex_buffer, &vctx->num_vertex_buffers, - buffers, start_slot, num_buffers); + buffers, start_slot, num_buffers, + unbind_num_trailing_slots); if (buffers) { for (unsigned i = 0; i < num_buffers; i++) { diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c index bf5bf353ee4..4ef04518804 100644 --- a/src/gallium/drivers/zink/zink_context.c +++ b/src/gallium/drivers/zink/zink_context.c @@ -483,6 +483,7 @@ static void zink_set_vertex_buffers(struct pipe_context *pctx, unsigned start_slot, unsigned num_buffers, + unsigned unbind_num_trailing_slots, const struct pipe_vertex_buffer *buffers) { struct zink_context *ctx = zink_context(pctx); @@ -502,7 +503,8 @@ zink_set_vertex_buffers(struct pipe_context *pctx, } util_set_vertex_buffers_mask(ctx->buffers, &ctx->buffers_enabled_mask, - buffers, start_slot, num_buffers); + buffers, start_slot, num_buffers, + unbind_num_trailing_slots); } static void diff --git a/src/gallium/frontends/lavapipe/lvp_execute.c b/src/gallium/frontends/lavapipe/lvp_execute.c index ebfb38c44ff..75a10c2d60d 100644 --- a/src/gallium/frontends/lavapipe/lvp_execute.c +++ b/src/gallium/frontends/lavapipe/lvp_execute.c @@ -237,7 +237,7 @@ static void emit_state(struct rendering_state *state) if (state->vb_dirty) { state->pctx->set_vertex_buffers(state->pctx, state->start_vb, - state->num_vb, state->vb); + state->num_vb, 0, state->vb); state->vb_dirty = false; } @@ -2755,7 +2755,7 @@ VkResult lvp_execute_cmds(struct lvp_device *device, } state.start_vb = -1; state.num_vb = 0; - state.pctx->set_vertex_buffers(state.pctx, 0, PIPE_MAX_ATTRIBS, NULL); + state.pctx->set_vertex_buffers(state.pctx, 0, 0, PIPE_MAX_ATTRIBS, NULL); state.pctx->bind_vertex_elements_state(state.pctx, NULL); state.pctx->bind_vs_state(state.pctx, NULL); state.pctx->bind_fs_state(state.pctx, NULL); diff --git a/src/gallium/frontends/nine/nine_state.c b/src/gallium/frontends/nine/nine_state.c index fd7ec82bc87..3d0461d374f 100644 --- a/src/gallium/frontends/nine/nine_state.c +++ b/src/gallium/frontends/nine/nine_state.c @@ -906,7 +906,7 @@ update_vertex_buffers(struct NineDevice9 *device) dummy_vtxbuf.is_user_buffer = false; dummy_vtxbuf.buffer_offset = 0; pipe->set_vertex_buffers(pipe, context->dummy_vbo_bound_at, - 1, &dummy_vtxbuf); + 1, 0, &dummy_vtxbuf); context->vbo_bound_done = TRUE; } mask &= ~(1 << context->dummy_vbo_bound_at); @@ -915,9 +915,9 @@ update_vertex_buffers(struct NineDevice9 *device) for (i = 0; mask; mask >>= 1, ++i) { if (mask & 1) { if (context->vtxbuf[i].buffer.resource) - pipe->set_vertex_buffers(pipe, i, 1, &context->vtxbuf[i]); + pipe->set_vertex_buffers(pipe, i, 1, 0, &context->vtxbuf[i]); else - pipe->set_vertex_buffers(pipe, i, 1, NULL); + pipe->set_vertex_buffers(pipe, i, 0, 1, NULL); } } @@ -2390,7 +2390,7 @@ CSMT_ITEM_NO_WAIT(nine_context_draw_primitive_from_vtxbuf, info.max_index = draw.count - 1; info.index.resource = NULL; - context->pipe->set_vertex_buffers(context->pipe, 0, 1, vtxbuf); + context->pipe->set_vertex_buffers(context->pipe, 0, 1, 0, vtxbuf); context->pipe->draw_vbo(context->pipe, &info, NULL, &draw, 1); } @@ -2425,7 +2425,7 @@ CSMT_ITEM_NO_WAIT(nine_context_draw_indexed_primitive_from_vtxbuf_idxbuf, else info.index.user = user_ibuf; - context->pipe->set_vertex_buffers(context->pipe, 0, 1, vbuf); + context->pipe->set_vertex_buffers(context->pipe, 0, 1, 0, vbuf); context->pipe->draw_vbo(context->pipe, &info, NULL, &draw, 1); } @@ -2916,7 +2916,7 @@ nine_context_clear(struct NineDevice9 *device) 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_vertex_buffers(pipe, 0, device->caps.MaxStreams, NULL); + pipe->set_vertex_buffers(pipe, 0, 0, device->caps.MaxStreams, NULL); for (i = 0; i < ARRAY_SIZE(context->rt); ++i) nine_bind(&context->rt[i], NULL); @@ -3100,10 +3100,10 @@ update_vertex_buffers_sw(struct NineDevice9 *device, int start_vertice, int num_ &(vtxbuf.buffer.resource)); u_upload_unmap(device->pipe_sw->stream_uploader); } - pipe_sw->set_vertex_buffers(pipe_sw, i, 1, &vtxbuf); + pipe_sw->set_vertex_buffers(pipe_sw, i, 1, 0, &vtxbuf); pipe_vertex_buffer_unreference(&vtxbuf); } else - pipe_sw->set_vertex_buffers(pipe_sw, i, 1, NULL); + pipe_sw->set_vertex_buffers(pipe_sw, i, 0, 1, NULL); } } nine_context_get_pipe_release(device); @@ -3243,7 +3243,7 @@ nine_state_after_draw_sw(struct NineDevice9 *device) int i; for (i = 0; i < 4; i++) { - pipe_sw->set_vertex_buffers(pipe_sw, i, 1, NULL); + pipe_sw->set_vertex_buffers(pipe_sw, i, 0, 1, NULL); if (sw_internal->transfers_so[i]) pipe->transfer_unmap(pipe, sw_internal->transfers_so[i]); sw_internal->transfers_so[i] = NULL; diff --git a/src/gallium/include/pipe/p_context.h b/src/gallium/include/pipe/p_context.h index 645f9835626..bea258b74bf 100644 --- a/src/gallium/include/pipe/p_context.h +++ b/src/gallium/include/pipe/p_context.h @@ -514,6 +514,7 @@ struct pipe_context { void (*set_vertex_buffers)( struct pipe_context *, unsigned start_slot, unsigned num_buffers, + unsigned unbind_num_trailing_slots, const struct pipe_vertex_buffer * ); /*@}*/ diff --git a/src/gallium/tests/graw/fs-fragcoord.c b/src/gallium/tests/graw/fs-fragcoord.c index 016bbaa0410..8f90713b26b 100644 --- a/src/gallium/tests/graw/fs-fragcoord.c +++ b/src/gallium/tests/graw/fs-fragcoord.c @@ -76,7 +76,7 @@ set_vertices(void) sizeof(vertices), vertices); - info.ctx->set_vertex_buffers(info.ctx, 0, 1, &vbuf); + info.ctx->set_vertex_buffers(info.ctx, 0, 1, 0, &vbuf); } diff --git a/src/gallium/tests/graw/fs-frontface.c b/src/gallium/tests/graw/fs-frontface.c index 956c7fee3a0..5cf290e62c8 100644 --- a/src/gallium/tests/graw/fs-frontface.c +++ b/src/gallium/tests/graw/fs-frontface.c @@ -98,7 +98,7 @@ set_vertices(void) sizeof(vertices), vertices); - info.ctx->set_vertex_buffers(info.ctx, 0, 1, &vbuf); + info.ctx->set_vertex_buffers(info.ctx, 0, 1, 0, &vbuf); } diff --git a/src/gallium/tests/graw/fs-test.c b/src/gallium/tests/graw/fs-test.c index 2373b93b05d..92b233b363d 100644 --- a/src/gallium/tests/graw/fs-test.c +++ b/src/gallium/tests/graw/fs-test.c @@ -179,7 +179,7 @@ static void set_vertices( void ) sizeof(vertices), vertices); - ctx->set_vertex_buffers(ctx, 0, 1, &vbuf); + ctx->set_vertex_buffers(ctx, 0, 1, 0, &vbuf); } static void set_vertex_shader( void ) diff --git a/src/gallium/tests/graw/fs-write-z.c b/src/gallium/tests/graw/fs-write-z.c index 4002dce15f1..4a9cdb86484 100644 --- a/src/gallium/tests/graw/fs-write-z.c +++ b/src/gallium/tests/graw/fs-write-z.c @@ -102,7 +102,7 @@ set_vertices(void) sizeof(vertices), vertices); - info.ctx->set_vertex_buffers(info.ctx, 0, 1, &vbuf); + info.ctx->set_vertex_buffers(info.ctx, 0, 1, 0, &vbuf); } diff --git a/src/gallium/tests/graw/gs-test.c b/src/gallium/tests/graw/gs-test.c index bcbe8ad95af..2e74dbe65c5 100644 --- a/src/gallium/tests/graw/gs-test.c +++ b/src/gallium/tests/graw/gs-test.c @@ -247,7 +247,7 @@ static void set_vertices( void ) vertices); } - ctx->set_vertex_buffers(ctx, 0, 1, &vbuf); + ctx->set_vertex_buffers(ctx, 0, 1, 0, &vbuf); } static void set_vertex_shader( void ) diff --git a/src/gallium/tests/graw/occlusion-query.c b/src/gallium/tests/graw/occlusion-query.c index b639a9bb9a1..141d0f2c66f 100644 --- a/src/gallium/tests/graw/occlusion-query.c +++ b/src/gallium/tests/graw/occlusion-query.c @@ -101,7 +101,7 @@ set_vertices(struct vertex *vertices, unsigned bytes) bytes, vertices); - info.ctx->set_vertex_buffers(info.ctx, 0, 1, &vbuf); + info.ctx->set_vertex_buffers(info.ctx, 0, 1, 0, &vbuf); } diff --git a/src/gallium/tests/graw/quad-sample.c b/src/gallium/tests/graw/quad-sample.c index 65d2917fbae..711f04e7804 100644 --- a/src/gallium/tests/graw/quad-sample.c +++ b/src/gallium/tests/graw/quad-sample.c @@ -105,7 +105,7 @@ static void set_vertices( void ) sizeof(vertices), vertices); - ctx->set_vertex_buffers(ctx, 0, 1, &vbuf); + ctx->set_vertex_buffers(ctx, 0, 1, 0, &vbuf); } static void set_vertex_shader( void ) diff --git a/src/gallium/tests/graw/quad-tex.c b/src/gallium/tests/graw/quad-tex.c index 40caad4ae90..474344f098b 100644 --- a/src/gallium/tests/graw/quad-tex.c +++ b/src/gallium/tests/graw/quad-tex.c @@ -63,7 +63,7 @@ static void set_vertices( void ) sizeof(vertices), vertices); - info.ctx->set_vertex_buffers(info.ctx, 0, 1, &vbuf); + info.ctx->set_vertex_buffers(info.ctx, 0, 1, 0, &vbuf); } static void set_vertex_shader( void ) diff --git a/src/gallium/tests/graw/shader-leak.c b/src/gallium/tests/graw/shader-leak.c index ba2e44af8b8..c944b6cfc68 100644 --- a/src/gallium/tests/graw/shader-leak.c +++ b/src/gallium/tests/graw/shader-leak.c @@ -95,7 +95,7 @@ static void set_vertices( void ) sizeof(vertices), vertices); - ctx->set_vertex_buffers(ctx, 0, 1, &vbuf); + ctx->set_vertex_buffers(ctx, 0, 1, 0, &vbuf); } static void set_vertex_shader( void ) diff --git a/src/gallium/tests/graw/tex-srgb.c b/src/gallium/tests/graw/tex-srgb.c index 964b4188b51..baa487653da 100644 --- a/src/gallium/tests/graw/tex-srgb.c +++ b/src/gallium/tests/graw/tex-srgb.c @@ -79,7 +79,7 @@ set_vertices(struct vertex *verts, unsigned num_verts) num_verts * sizeof(struct vertex), verts); - info.ctx->set_vertex_buffers(info.ctx, 0, 1, &vbuf); + info.ctx->set_vertex_buffers(info.ctx, 0, 1, 0, &vbuf); } static void set_vertex_shader( void ) diff --git a/src/gallium/tests/graw/tex-swizzle.c b/src/gallium/tests/graw/tex-swizzle.c index 538e12e7477..f21c76a4e08 100644 --- a/src/gallium/tests/graw/tex-swizzle.c +++ b/src/gallium/tests/graw/tex-swizzle.c @@ -61,7 +61,7 @@ static void set_vertices(void) sizeof(vertices), vertices); - info.ctx->set_vertex_buffers(info.ctx, 0, 1, &vbuf); + info.ctx->set_vertex_buffers(info.ctx, 0, 1, 0, &vbuf); } static void set_vertex_shader(void) diff --git a/src/gallium/tests/graw/tri-gs.c b/src/gallium/tests/graw/tri-gs.c index b0cdb33e52b..39382cb52b4 100644 --- a/src/gallium/tests/graw/tri-gs.c +++ b/src/gallium/tests/graw/tri-gs.c @@ -96,7 +96,7 @@ static void set_vertices( void ) sizeof(vertices), vertices); - ctx->set_vertex_buffers(ctx, 0, 1, &vbuf); + ctx->set_vertex_buffers(ctx, 0, 1, 0, &vbuf); } static void set_vertex_shader( void ) diff --git a/src/gallium/tests/graw/tri-instanced.c b/src/gallium/tests/graw/tri-instanced.c index a5cc3dc8106..c4adfa1d9ac 100644 --- a/src/gallium/tests/graw/tri-instanced.c +++ b/src/gallium/tests/graw/tri-instanced.c @@ -147,7 +147,7 @@ static void set_vertices( void ) sizeof(inst_data), inst_data); - ctx->set_vertex_buffers(ctx, 0, 2, vbuf); + ctx->set_vertex_buffers(ctx, 0, 2, 0, vbuf); } static void set_vertex_shader( void ) diff --git a/src/gallium/tests/graw/tri-large.c b/src/gallium/tests/graw/tri-large.c index e1b0888bf04..c6a77728fe0 100644 --- a/src/gallium/tests/graw/tri-large.c +++ b/src/gallium/tests/graw/tri-large.c @@ -65,7 +65,7 @@ static void set_vertices( void ) sizeof(vertices), vertices); - info.ctx->set_vertex_buffers(info.ctx, 0, 1, &vbuf); + info.ctx->set_vertex_buffers(info.ctx, 0, 1, 0, &vbuf); } diff --git a/src/gallium/tests/graw/tri.c b/src/gallium/tests/graw/tri.c index 9882384a2f6..cec94555334 100644 --- a/src/gallium/tests/graw/tri.c +++ b/src/gallium/tests/graw/tri.c @@ -62,7 +62,7 @@ static void set_vertices( void ) sizeof(vertices), vertices); - info.ctx->set_vertex_buffers(info.ctx, 0, 1, &vbuf); + info.ctx->set_vertex_buffers(info.ctx, 0, 1, 0, &vbuf); } diff --git a/src/gallium/tests/graw/vs-test.c b/src/gallium/tests/graw/vs-test.c index fb096354935..969ffe74904 100644 --- a/src/gallium/tests/graw/vs-test.c +++ b/src/gallium/tests/graw/vs-test.c @@ -172,7 +172,7 @@ static void set_vertices( void ) sizeof(vertices), vertices); - ctx->set_vertex_buffers(ctx, 0, 1, &vbuf); + ctx->set_vertex_buffers(ctx, 0, 1, 0, &vbuf); } static void set_vertex_shader( void ) diff --git a/src/mesa/state_tracker/st_atom_array.c b/src/mesa/state_tracker/st_atom_array.c index 1faf72b0db5..406baa73e3e 100644 --- a/src/mesa/state_tracker/st_atom_array.c +++ b/src/mesa/state_tracker/st_atom_array.c @@ -354,7 +354,8 @@ st_update_array(struct st_context *st) cso_set_vertex_buffers_and_elements(cso, &velements, num_vbuffers, unbind_trailing_vbuffers, - vbuffer, uses_user_vertex_buffers); + uses_user_vertex_buffers, + vbuffer); st->last_num_vbuffers = num_vbuffers; /* Unreference uploaded current attrib buffer. */ diff --git a/src/mesa/state_tracker/st_draw_feedback.c b/src/mesa/state_tracker/st_draw_feedback.c index ba51420a23e..206fa410bdc 100644 --- a/src/mesa/state_tracker/st_draw_feedback.c +++ b/src/mesa/state_tracker/st_draw_feedback.c @@ -182,7 +182,7 @@ st_feedback_draw_vbo(struct gl_context *ctx, } } - draw_set_vertex_buffers(draw, 0, num_vbuffers, vbuffers); + draw_set_vertex_buffers(draw, 0, num_vbuffers, 0, vbuffers); draw_set_vertex_elements(draw, vp->num_inputs, velements.velems); unsigned start = 0; @@ -517,7 +517,7 @@ st_feedback_draw_vbo(struct gl_context *ctx, pipe_buffer_unmap(pipe, vb_transfer[buf]); draw_set_mapped_vertex_buffer(draw, buf, NULL, 0); } - draw_set_vertex_buffers(draw, 0, num_vbuffers, NULL); + draw_set_vertex_buffers(draw, 0, 0, num_vbuffers, NULL); draw_bind_vertex_shader(draw, NULL); }