Module: Mesa Branch: master Commit: 9fb5d7acbbab04af3c85f7b6188af16eda824b43 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=9fb5d7acbbab04af3c85f7b6188af16eda824b43
Author: Kenneth Graunke <kenn...@whitecape.org> Date: Fri Jan 15 01:02:35 2021 -0800 tnl: Reset nr_bos to 0 between map/unmap cycles. _tnl_draw_prims loops over the prims, and for each one, maps the VBOs, draws, and unmaps them. But it failed to reset nr_bos = 0 between each loop iteration, which meant that when processing prim[n], the BO list had all BOs for prior primitives too. Assuming each primitive used the same VBOs, that means the same VBO would appear in the list multiple times, and it would try to unmap the same BO multiple times. This triggered asserts on the second unmap, as it had already been unmapped. Fixes Piglit's oes_draw_elements_base_vertex-multidrawelements on i915. Fixes: e99e7aa4c1d ("mesa: switch Draw(Range)Elements(BaseVertex) calls to DrawGallium") Acked-by: Marek Olšák <marek.ol...@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8522> --- src/mesa/tnl/t_draw.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mesa/tnl/t_draw.c b/src/mesa/tnl/t_draw.c index bffab548a0f..1370af691c2 100644 --- a/src/mesa/tnl/t_draw.c +++ b/src/mesa/tnl/t_draw.c @@ -494,7 +494,7 @@ void _tnl_draw_prims(struct gl_context *ctx, * one for the index buffer. */ struct gl_buffer_object *bo[VERT_ATTRIB_MAX + 1]; - GLuint nr_bo = 0; + GLuint nr_bo; GLuint inst; assert(num_instances > 0); @@ -517,6 +517,7 @@ void _tnl_draw_prims(struct gl_context *ctx, * They will need to be unmapped below. */ for (inst = 0; inst < num_instances; inst++) { + nr_bo = 0; bind_prims(ctx, &prim[i], this_nr_prims); bind_inputs(ctx, arrays, max_index + prim[i].basevertex + 1, _______________________________________________ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit