[Mesa-dev] [Bug 98851] triangle clipping causes wrong interpolation of non-perspective corrected attributes

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Fri Nov 25 07:47:48 UTC 2016


https://bugs.freedesktop.org/show_bug.cgi?id=98851

Ilia Mirkin <imirkin at alum.mit.edu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|triangle clipping causes    |triangle clipping causes
                   |wrong ... something         |wrong interpolation of
                   |                            |non-perspective corrected
                   |                            |attributes

--- Comment #2 from Ilia Mirkin <imirkin at alum.mit.edu> ---
Ah yeah, looks like that's exactly what's going on -

src/gallium/auxiliary/draw/draw_pipe_clip.c:interp has the following logic:

   /**
    * Compute the t in screen-space instead of 3d space to use
    * for noperspective interpolation.
    *
    * The points can be aligned with the X axis, so in that case try
    * the Y.  When both points are at the same screen position, we can
    * pick whatever value (the interpolated point won't be in front
    * anyway), so just use the 3d t.
    */
   if (clip->num_linear_attribs) {
      int k;
      t_nopersp = t;
      /* find either in.x != out.x or in.y != out.y */
      for (k = 0; k < 2; k++) {
         if (in->clip_pos[k] != out->clip_pos[k]) {
            /* do divide by W, then compute linear interpolation factor */
            float in_coord = in->clip_pos[k] / in->clip_pos[3];
            float out_coord = out->clip_pos[k] / out->clip_pos[3];
            float dst_coord = dst->clip_pos[k] / dst->clip_pos[3];
            t_nopersp = (dst_coord - out_coord) / (in_coord - out_coord);
            break;
         }
      }
      for (j = 0; j < clip->num_linear_attribs; j++) {
         const unsigned attr = clip->linear_attribs[j];
         interp_attr(dst->data[attr], t_nopersp, in->data[attr],
out->data[attr]);
      }
   }

swr needs to grow a linear-interpolated attribute mask and incorporate the
above logic for those.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20161125/8feb7307/attachment-0001.html>


More information about the mesa-dev mailing list