diff options
author | Roland Scheidegger <[email protected]> | 2015-12-11 02:21:17 +0100 |
---|---|---|
committer | Roland Scheidegger <[email protected]> | 2015-12-11 02:21:39 +0100 |
commit | 64c59b06244fc34f015f1f75b8205ac597ab0105 (patch) | |
tree | df97c0eb6e98864e87847224e4d65cc870c9e06b /src/gallium/auxiliary | |
parent | 5362e53a068d5718b303dfad88bb623df22662e1 (diff) |
draw: fix clipping with linear interpolated values and gl_ClipVertex
Discovered this when working on other clip code, apparently didn't work
correctly - the combination of linear interpolated values and using
gl_ClipVertex produced wrong values (failing all such combinations
in piglits glsl-1.30 interpolation tests, named
interpolation-noperspective-XXX-vertex).
Use the pre-clip-pos values when determining the interpolation factor to
fix this.
Noone really understands this code well, but everybody agrees this looks
sane... This fixes all those failing tests (10 in total) both with
the llvm and non-llvm draw paths, with no piglit regressions.
Reviewed-by: Brian Paul <[email protected]>
Reviewed-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary')
-rw-r--r-- | src/gallium/auxiliary/draw/draw_pipe_clip.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/gallium/auxiliary/draw/draw_pipe_clip.c b/src/gallium/auxiliary/draw/draw_pipe_clip.c index 35e54f4a8be..47765cd0ef9 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_clip.c +++ b/src/gallium/auxiliary/draw/draw_pipe_clip.c @@ -192,11 +192,11 @@ static void interp(const struct clip_stage *clip, t_nopersp = t; /* find either in.x != out.x or in.y != out.y */ for (k = 0; k < 2; k++) { - if (in->clip[k] != out->clip[k]) { + if (in->pre_clip_pos[k] != out->pre_clip_pos[k]) { /* do divide by W, then compute linear interpolation factor */ - float in_coord = in->clip[k] / in->clip[3]; - float out_coord = out->clip[k] / out->clip[3]; - float dst_coord = dst->clip[k] / dst->clip[3]; + float in_coord = in->pre_clip_pos[k] / in->pre_clip_pos[3]; + float out_coord = out->pre_clip_pos[k] / out->pre_clip_pos[3]; + float dst_coord = dst->pre_clip_pos[k] / dst->pre_clip_pos[3]; t_nopersp = (dst_coord - out_coord) / (in_coord - out_coord); break; } |