[Mesa-dev] [PATCH] draw: fix incorrect color of flat-shaded clipped lines

Jose Fonseca jfonseca at vmware.com
Mon Feb 3 20:20:14 CET 2014



----- Original Message -----
> When we clipped a line weren't copying the provoking vertex
> color to the second vertex.  We also weren't checking for
> first vs. last provoking vertex.
> 
> Fixes failures found with the new piglit line-flat-clip-color test.
> 
> Cc: 10.0, 10.1 <mesa-stable at lists.freedesktop.org>
> ---
>  src/gallium/auxiliary/draw/draw_pipe_clip.c |   13 ++++++++++++-
>  1 file changed, 12 insertions(+), 1 deletion(-)
> 
> diff --git a/src/gallium/auxiliary/draw/draw_pipe_clip.c
> b/src/gallium/auxiliary/draw/draw_pipe_clip.c
> index de354e9..d8b56de 100644
> --- a/src/gallium/auxiliary/draw/draw_pipe_clip.c
> +++ b/src/gallium/auxiliary/draw/draw_pipe_clip.c
> @@ -588,7 +588,12 @@ do_clip_line( struct draw_stage *stage,
>  
>     if (v0->clipmask) {
>        interp( clipper, stage->tmp[0], t0, v0, v1, viewport_index );
> -      copy_flat(stage, stage->tmp[0], v0);
> +      if (stage->draw->rasterizer->flatshade_first) {
> +         copy_flat(stage, stage->tmp[0], v0);  /* copy v0 color to tmp[0] */
> +      }
> +      else {
> +         copy_flat(stage, stage->tmp[0], v1);  /* copy v1 color to tmp[0] */
> +      }
>        newprim.v[0] = stage->tmp[0];
>     }
>     else {
> @@ -597,6 +602,12 @@ do_clip_line( struct draw_stage *stage,
>  
>     if (v1->clipmask) {
>        interp( clipper, stage->tmp[1], t1, v1, v0, viewport_index );
> +      if (stage->draw->rasterizer->flatshade_first) {
> +         copy_flat(stage, stage->tmp[1], v0);  /* copy v0 color to tmp[1] */
> +      }
> +      else {
> +         copy_flat(stage, stage->tmp[1], v1);  /* copy v1 color to tmp[1] */
> +      }
>        newprim.v[1] = stage->tmp[1];
>     }
>     else {
> --
> 1.7.10.4
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://urldefense.proofpoint.com/v1/url?u=http://lists.freedesktop.org/mailman/listinfo/mesa-dev&k=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0A&r=NMr9uy2iTjWVixC0wOcYCWEIYhfo80qKwRgdodpoDzA%3D%0A&m=JXBgl5uBqvPNX%2BdbIW3nyeyaAE1k%2Fe5i%2BFx%2FJu%2Fujvs%3D%0A&s=23b3fafec3c062f542eff7bdeda679e533c99024a5f2b0708c0ee862c8342ca7
> 

Reviewed-by: Jose Fonseca <jfonseca at vmware.com>


More information about the mesa-dev mailing list