On 2 July 2012 15:12, Vadim Girlin <span dir="ltr"><<a href="mailto:vadimgirlin@gmail.com" target="_blank">vadimgirlin@gmail.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5">On Mon, 2012-07-02 at 14:19 -0700, Paul Berry wrote:<br>
> On 2 July 2012 13:45, Vadim Girlin <<a href="mailto:vadimgirlin@gmail.com">vadimgirlin@gmail.com</a>> wrote:<br>
><br>
> > On Mon, 2012-07-02 at 10:08 -0700, Paul Berry wrote:<br>
> > > On 2 July 2012 08:04, Vadim Girlin <<a href="mailto:vadimgirlin@gmail.com">vadimgirlin@gmail.com</a>> wrote:<br>
> > >         On Sun, 2012-06-24 at 11:18 +0200, Olivier Galibert wrote:<br>
> > >         > That old bug was hidden but the clipper always interpolating<br>
> > >         in 3d<br>
> > >         > space no matter what it should have been doing.  Now that<br>
> > >         the<br>
> > >         > interpolation has been fixed, the bug shows up.<br>
> > >         ><br>
> > >         > Fixes bugzilla 51364.<br>
> > >         ><br>
> > >         > Signed-off-by: Olivier Galibert <<a href="mailto:galibert@pobox.com">galibert@pobox.com</a>><br>
> > >         ><br>
> > >         > diff --git a/src/mesa/state_tracker/st_program.c<br>
> > >         b/src/mesa/state_tracker/st_program.c<br>
> > >         > index e6664fb..9f98298 100644<br>
> > >         > --- a/src/mesa/state_tracker/st_program.c<br>
> > >         > +++ b/src/mesa/state_tracker/st_program.c<br>
> > >         > @@ -569,12 +569,12 @@ st_translate_fragment_program(struct<br>
> > >         st_context *st,<br>
> > >         >           case FRAG_ATTRIB_CLIP_DIST0:<br>
> > >         >              input_semantic_name[slot] =<br>
> > >         TGSI_SEMANTIC_CLIPDIST;<br>
> > >         >              input_semantic_index[slot] = 0;<br>
> > >         > -            interpMode[slot] = TGSI_INTERPOLATE_LINEAR;<br>
> > >         > +            interpMode[slot] =<br>
> > >         TGSI_INTERPOLATE_PERSPECTIVE;<br>
> > >         >              break;<br>
> > >         >           case FRAG_ATTRIB_CLIP_DIST1:<br>
> > >         >              input_semantic_name[slot] =<br>
> > >         TGSI_SEMANTIC_CLIPDIST;<br>
> > >         >              input_semantic_index[slot] = 1;<br>
> > >         > -            interpMode[slot] = TGSI_INTERPOLATE_LINEAR;<br>
> > >         > +            interpMode[slot] =<br>
> > >         TGSI_INTERPOLATE_PERSPECTIVE;<br>
> > ><br>
> > ><br>
> > >         At first glance this change doesn't seem correct, GLSL 1.30<br>
> > >         spec says<br>
> > >         that clip distances are interpolated linearly. Am I missing<br>
> > >         something?<br>
> > ><br>
> > > I think when the spec says "The clip distances will be linearly<br>
> > > interpolated across the primitive...", they mean "linear in 3D space".<br>
> > > Interpolating clip distances in screen space would produce really bad<br>
> > > artifacts, IMHO.<br>
> ><br>
> > Looking into it, I think you are right, sorry for the noise.<br>
> ><br>
> > Though then I have some doubts about the "fs-clip-distance-interpolated"<br>
> > test. AFAICS r600g in fact uses different interpolation for ClipDistance<br>
> > inputs with and without the patch, but the test does pass in both<br>
> > cases.<br>
> ><br>
><br>
> Yeah, fs-clip-distance-interpolated only checks that the fragment shader<br>
> sees properly interpolated values for gl_ClipDistance.  It doesn't check<br>
> that the implementation uses the correct form of interpolation to decide<br>
> where to clip the primitive.  I suspect that's the reason the test passes<br>
> in both cases.  I wasn't thinking carefully enough when I wrote the test to<br>
> realize that these two things ought to be tested separately.<br>
<br>
</div></div>AFAIK on r600 we have no control over the interpolation of the clip<br>
distances for clipping, so it should be always correct, this patch only<br>
affects the interpolation of the values that are passed to the fragment<br>
shader.<br></blockquote><div><br>Oh, ok.  I misunderstood.  Sandy Bridge and Ivy Bridge are similar.<br> </div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">

<br>
I think the test should draw something with perspective to check whether<br>
the interpolation is perspective-correct.<br></blockquote><div><br>Yeah, that makes sense.<br> </div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">

<div class="im"><br>
> If you would like to add a piglit test to cover the case I missed, I would<br>
> be delighted :)<br>
<br>
</div>I'll try to find the time :)<br>
<br>
</blockquote></div><br>