summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2014-02-03 11:33:03 -0700
committerCarl Worth <[email protected]>2014-03-04 12:59:27 -0800
commite70e368af51a861c646a351d6d61b4fdf7253e89 (patch)
tree3703703f7dcdbda39db08c6f93a2b95534523710 /src
parente10b0e0f50e65e59305bc93e649b0db5bc0276ac (diff)
draw: fix incorrect color of flat-shaded clipped lines
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" <[email protected]> Reviewed-by: Jose Fonseca <[email protected]> (cherry picked from commit fc3fcd1e01093e8ab8d06d95c53f875ace57ca7f)
Diffstat (limited to 'src')
-rw-r--r--src/gallium/auxiliary/draw/draw_pipe_clip.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/gallium/auxiliary/draw/draw_pipe_clip.c b/src/gallium/auxiliary/draw/draw_pipe_clip.c
index dbb67575843..7409c1977b8 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 {