From d916175c4d965942325bbb4a684fac45fb6ab9e2 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 15 Oct 2015 21:25:18 -0600 Subject: vbo: simplify some code in vbo_copy_vertices() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As before, use a new 'last_prim' pointer to simplify things. Plus, add some const qualifiers. v2: use 'sz' in another place, per Sinclair. And update subject line. Reviewed-by: Marek Olšák Reviewed-by: Jose Fonseca Reviewed-by: Sinclair Yeh --- src/mesa/vbo/vbo_exec_draw.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src/mesa/vbo/vbo_exec_draw.c') diff --git a/src/mesa/vbo/vbo_exec_draw.c b/src/mesa/vbo/vbo_exec_draw.c index 781991bd0bf..9b1103dad72 100644 --- a/src/mesa/vbo/vbo_exec_draw.c +++ b/src/mesa/vbo/vbo_exec_draw.c @@ -75,13 +75,12 @@ vbo_exec_debug_verts( struct vbo_exec_context *exec ) static GLuint vbo_copy_vertices( struct vbo_exec_context *exec ) { - GLuint nr = exec->vtx.prim[exec->vtx.prim_count-1].count; + struct _mesa_prim *last_prim = &exec->vtx.prim[exec->vtx.prim_count - 1]; + const GLuint nr = last_prim->count; GLuint ovf, i; - GLuint sz = exec->vtx.vertex_size; + const GLuint sz = exec->vtx.vertex_size; fi_type *dst = exec->vtx.copied.buffer; - const fi_type *src = (exec->vtx.buffer_map + - exec->vtx.prim[exec->vtx.prim_count-1].start * - exec->vtx.vertex_size); + const fi_type *src = exec->vtx.buffer_map + last_prim->start * sz; switch (exec->ctx->Driver.CurrentExecPrimitive) { case GL_POINTS: @@ -127,7 +126,7 @@ vbo_copy_vertices( struct vbo_exec_context *exec ) case GL_TRIANGLE_STRIP: /* no parity issue, but need to make sure the tri is not drawn twice */ if (nr & 1) { - exec->vtx.prim[exec->vtx.prim_count-1].count--; + last_prim->count--; } /* fallthrough */ case GL_QUAD_STRIP: -- cgit v1.2.3