[Mesa-dev] [PATCH] draw: fix non-perspective interpolation in interp()

Paul Berry stereotype441 at gmail.com
Sat Feb 16 11:17:25 PST 2013


On 16 February 2013 10:58, Brian Paul <brianp at vmware.com> wrote:

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

I think you mean "divide-by-W" :)


>
> Fixes http://bugs.freedesktop.org/show_bug.cgi?id=60938
>
> Note: This is a candidate for the 9.1 branch.
> ---
>  src/gallium/auxiliary/draw/draw_pipe_clip.c |   11 ++++++++---
>  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 7b879c4..3110809 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
> --
> 1.7.3.4
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20130216/a46ffb8f/attachment-0001.html>


More information about the mesa-dev mailing list