[Mesa-dev] [PATCH 06/10] vbo: simplify some code in vbo_exec_debug_verts()

Sinclair Yeh syeh at vmware.com
Fri Oct 16 19:14:44 PDT 2015


On Fri, Oct 16, 2015 at 03:25:13PM -0600, Brian Paul wrote:
> As before, use a new 'last_prim' pointer to simplify things.  Plus, add
> some const qualifiers.
> ---
>  src/mesa/vbo/vbo_exec_draw.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/src/mesa/vbo/vbo_exec_draw.c b/src/mesa/vbo/vbo_exec_draw.c
> index 781991b..412ebb6 100644
> --- a/src/mesa/vbo/vbo_exec_draw.c
> +++ b/src/mesa/vbo/vbo_exec_draw.c
> @@ -75,13 +75,13 @@ 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 * exec->vtx.vertex_size;
Can use "sz" here                                             ^

Otherwise, looks good to me.

>  
>     switch (exec->ctx->Driver.CurrentExecPrimitive) {
>     case GL_POINTS:
> @@ -127,7 +127,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:
> -- 
> 1.9.1
> 


More information about the mesa-dev mailing list