Fix #122523: Crash/missing loose edge drawing with two viewports

With two viewports, and one viewport with overlays turned off, one viewport
first requests positions without calculating loose geometry, then the second
viewport can request the loose geometry index buffer. In that case the
previously-calculated positions VBO has the wrong size.

To fix this, always calculate loose geometry when the positions are requested.
That's required because we no simple way of checking whether the previously
uploaded positions included loose geometry. That was the state before recent
refactors in this area anyway.

This makes it clear that the optimization to not calculate loose geometry is
meaningless, because the positions buffer will always be requested at some
point when drawing a mesh.
This commit is contained in:
Hans Goudey 2024-06-05 10:32:27 -04:00
parent 56ff0d414a
commit 05142b3ea8

@ -547,6 +547,7 @@ static void mesh_extract_render_data_node_exec(void *__restrict task_data)
const bool calc_loose_geom = DRW_ibo_requested(buffers.ibo.lines) ||
DRW_ibo_requested(buffers.ibo.lines_loose) ||
DRW_ibo_requested(buffers.ibo.points) ||
DRW_vbo_requested(buffers.vbo.pos) ||
DRW_vbo_requested(buffers.vbo.edit_data) ||
(iter_type & (MR_ITER_LOOSE_EDGE | MR_ITER_LOOSE_VERT)) ||
(data_flag & MR_DATA_LOOSE_GEOM);