summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/auxiliary')
-rw-r--r--src/gallium/auxiliary/draw/draw_pipe_clip.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/gallium/auxiliary/draw/draw_pipe_clip.c b/src/gallium/auxiliary/draw/draw_pipe_clip.c
index 7b879c4cd50..3110809ce0e 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_clip.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_clip.c
@@ -167,12 +167,17 @@ static void interp( const struct clip_stage *clip,
{
int k;
t_nopersp = t;
- for (k = 0; k < 2; k++)
+ /* find either in.x != out.x or in.y != out.y */
+ for (k = 0; k < 2; k++) {
if (in->clip[k] != out->clip[k]) {
- t_nopersp = (dst->clip[k] - out->clip[k]) /
- (in->clip[k] - out->clip[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];
+ t_nopersp = (dst_coord - out_coord) / (in_coord - out_coord);
break;
}
+ }
}
/* Other attributes