[Mesa-dev] Mesa (master): draw: Remove unnecessary vertex flag ANDs.

Brian Paul brianp at vmware.com
Fri Aug 6 06:44:37 PDT 2010


On 08/05/2010 11:53 PM, Chia-I Wu wrote:
> Module: Mesa
> Branch: master
> Commit: 642d5ba79abc6a231a5fdabb3454b9b082b0d7f8
> URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=642d5ba79abc6a231a5fdabb3454b9b082b0d7f8
>
> Author: Chia-I Wu<olv at lunarg.com>
> Date:   Wed Aug  4 14:37:40 2010 +0800
>
> draw: Remove unnecessary vertex flag ANDs.
>
> Vertex flags are a contract between vcache and the pipeline.  They are
> set only for the first vertex of a primitive.
>
> ---
>
>   src/gallium/auxiliary/draw/draw_pipe.c |   34 ++++++++++++++-----------------
>   1 files changed, 15 insertions(+), 19 deletions(-)
>
> diff --git a/src/gallium/auxiliary/draw/draw_pipe.c b/src/gallium/auxiliary/draw/draw_pipe.c
> index 3421b82..070ac80 100644
> --- a/src/gallium/auxiliary/draw/draw_pipe.c
> +++ b/src/gallium/auxiliary/draw/draw_pipe.c
> @@ -179,18 +179,17 @@ static void do_triangle( struct draw_context *draw,
>      do_triangle( draw,                                          \
>                   i0,  /* flags */                               \
>                   verts + stride * (i0 & ~DRAW_PIPE_FLAG_MASK),  \
> -                verts + stride * (i1 & ~DRAW_PIPE_FLAG_MASK),  \
> -                verts + stride * (i2 & ~DRAW_PIPE_FLAG_MASK) )
> +                verts + stride * (i1),                         \
> +                verts + stride * (i2) )

[...]


Could you add some assertions to verify that those indexes do not have 
any flag bits set?  I had to add the & ~MASK in the other places to 
fix bugs in the past.  And those bugs were quite difficult to isolate. 
  I'd rather not go through that again.

-Brian


More information about the mesa-dev mailing list