From: Marek Olšák Date: Sat, 1 Feb 2020 01:33:14 +0000 (-0500) Subject: vbo: delay flagging FLUSH_STORED_VERTICES until glEnd X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=27bd241103e8fa1fc34859cac6bd23d5a5fb04fe;p=mesa.git vbo: delay flagging FLUSH_STORED_VERTICES until glEnd Only state changes see this, which can't occur before glEnd. Reviewed-by: Mathias Fröhlich Part-of: --- diff --git a/src/mesa/vbo/vbo_exec_api.c b/src/mesa/vbo/vbo_exec_api.c index 597f07c0212..1d59f38bb28 100644 --- a/src/mesa/vbo/vbo_exec_api.c +++ b/src/mesa/vbo/vbo_exec_api.c @@ -525,11 +525,8 @@ do { \ /* dst now points at the beginning of the next vertex */ \ exec->vtx.buffer_ptr = (fi_type*)dst; \ \ - /* Set FLUSH_STORED_VERTICES to indicate that there's now */ \ - /* something to draw (not just updating a color or texcoord).*/ \ /* Don't set FLUSH_UPDATE_CURRENT because */ \ /* Current.Attrib[VBO_ATTRIB_POS] is never used. */ \ - ctx->Driver.NeedFlush |= FLUSH_STORED_VERTICES; \ \ if (unlikely(++exec->vtx.vert_count >= exec->vtx.max_vert)) \ vbo_exec_vtx_wrap(exec); \ @@ -900,9 +897,13 @@ vbo_exec_End(void) if (exec->vtx.prim_count > 0) { /* close off current primitive */ struct _mesa_prim *last_prim = &exec->vtx.prim[exec->vtx.prim_count - 1]; + unsigned count = exec->vtx.vert_count - last_prim->start; last_prim->end = 1; - last_prim->count = exec->vtx.vert_count - last_prim->start; + last_prim->count = count; + + if (count) + ctx->Driver.NeedFlush |= FLUSH_STORED_VERTICES; /* Special handling for GL_LINE_LOOP */ if (last_prim->mode == GL_LINE_LOOP && last_prim->begin == 0) {