From 27bd241103e8fa1fc34859cac6bd23d5a5fb04fe Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Fri, 31 Jan 2020 20:33:14 -0500 Subject: [PATCH] vbo: delay flagging FLUSH_STORED_VERTICES until glEnd MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Only state changes see this, which can't occur before glEnd. Reviewed-by: Mathias Fröhlich Part-of: --- src/mesa/vbo/vbo_exec_api.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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) { -- 2.30.2