draw: fix non-perspective interpolation in interp()

This fixes a regression from ab74fee5e1.
When we use the clip coordinate to compute the screen-space interpolation
factor, we need to first apply the divide-by-W step to the clip
coordinate.

Fixes http://bugs.freedesktop.org/show_bug.cgi?id=60938

Note: This is a candidate for the 9.1 branch.
(cherry picked from commit 5da967aff5)
This commit is contained in:
Brian Paul 2013-02-16 11:54:22 -07:00 committed by Ian Romanick
parent 9071c094e8
commit 475548f6c9

View file

@ -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