Summary: | triangle clipping causes wrong interpolation of non-perspective corrected attributes | ||
---|---|---|---|
Product: | Mesa | Reporter: | Ilia Mirkin <imirkin> |
Component: | Drivers/Gallium/swr | Assignee: | mesa-dev |
Status: | RESOLVED MOVED | QA Contact: | mesa-dev |
Severity: | normal | ||
Priority: | medium | ||
Version: | git | ||
Hardware: | Other | ||
OS: | All | ||
Whiteboard: | |||
i915 platform: | i915 features: |
Description
Ilia Mirkin
2016-11-25 07:12:31 UTC
One thing I wonder about is whether the clipper needs to know that it's a no-perspective attribute. There's an interpolation step done in clip.h:intersect, and I'm not sure that's right for the non-perspective-correcting case. (I'm also not sure that it's wrong...) 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. -- GitLab Migration Automatic Message -- This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/mesa/mesa/issues/190. |
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.