Re: [Mesa-dev] Re mesa/st: add tgsi-lowering code for depth-clamp

2019-08-05 Thread Gert Wollny
Am Samstag, den 03.08.2019, 13:01 -0400 schrieb Ilia Mirkin: > > Gert - your change should be all good from what I can tell > experimentally. Although I still don't understand why. Thanks for testing, and I think Mareks explanation is spot on. Best, Gert > > -ilia > > On Sat, Aug 3, 2019

Re: [Mesa-dev] Re mesa/st: add tgsi-lowering code for depth-clamp

2019-08-03 Thread Ilia Mirkin
I've done the tests to satisfy my own curiousity... it all works correctly as-is, it would seem. I need to go back and re-look at barycentric coordinates generation. Gert - your change should be all good from what I can tell experimentally. Although I still don't understand why. -ilia On Sat,

Re: [Mesa-dev] Re mesa/st: add tgsi-lowering code for depth-clamp

2019-08-02 Thread Marek Olšák
Z is 0 at the near plane and 1 at the far plane, but the planes can have an arbitrary distance from the viewer, therefore Z Is irrelevant. W is the real distance from the viewer. The greater W is, the smaller (farther away) the object is, because W is the divisor (which makes objects smaller as it

Re: [Mesa-dev] Re mesa/st: add tgsi-lowering code for depth-clamp

2019-08-02 Thread Ilia Mirkin
Compare generated_tests/spec/glsl-1.30/execution/interpolation/interpolation-smooth-other-smooth-none.shader_test generated_tests/spec/glsl-1.30/execution/interpolation/interpolation-noperspective-other-smooth-none.shader_test as you can see, the first one is perspective-interpolated and has a lo

Re: [Mesa-dev] Re mesa/st: add tgsi-lowering code for depth-clamp

2019-08-02 Thread Marek Olšák
IIRC, perspective interpolation is driven by W, not Z. Interpolating W and then computing barycentric coordinates using 1/W is what causes the perspective distortion. Marek On Fri, Aug 2, 2019 at 4:59 PM Ilia Mirkin wrote: > On Fri, Aug 2, 2019 at 3:46 PM Gert Wollny > wrote: > > > > Am Freita

Re: [Mesa-dev] Re mesa/st: add tgsi-lowering code for depth-clamp

2019-08-02 Thread Ilia Mirkin
On Fri, Aug 2, 2019 at 3:46 PM Gert Wollny wrote: > > Am Freitag, den 02.08.2019, 15:09 -0400 schrieb Ilia Mirkin: > > On Fri, Aug 2, 2019 at 1:28 PM Gert Wollny > > wrote: > > > Am Donnerstag, den 01.08.2019, 07:22 -0400 schrieb Ilia Mirkin: > > > > Hey Gert, > > > > > > > > I'm looking at > > >

Re: [Mesa-dev] Re mesa/st: add tgsi-lowering code for depth-clamp

2019-08-02 Thread Gert Wollny
Am Freitag, den 02.08.2019, 15:09 -0400 schrieb Ilia Mirkin: > On Fri, Aug 2, 2019 at 1:28 PM Gert Wollny > wrote: > > Am Donnerstag, den 01.08.2019, 07:22 -0400 schrieb Ilia Mirkin: > > > Hey Gert, > > > > > > I'm looking at > > > https://cgit.freedesktop.org/mesa/mesa/commit/?id=b048d8bf8f05675

Re: [Mesa-dev] Re mesa/st: add tgsi-lowering code for depth-clamp

2019-08-02 Thread Ilia Mirkin
On Fri, Aug 2, 2019 at 1:28 PM Gert Wollny wrote: > > Am Donnerstag, den 01.08.2019, 07:22 -0400 schrieb Ilia Mirkin: > > Hey Gert, > > > > I'm looking at > > https://cgit.freedesktop.org/mesa/mesa/commit/?id=b048d8bf8f056759d1845a799d4ba2ac84bce30f > > , which attempts to implement depth clamping

Re: [Mesa-dev] Re mesa/st: add tgsi-lowering code for depth-clamp

2019-08-02 Thread Gert Wollny
Am Donnerstag, den 01.08.2019, 07:22 -0400 schrieb Ilia Mirkin: > Hey Gert, > > I'm looking at > https://cgit.freedesktop.org/mesa/mesa/commit/?id=b048d8bf8f056759d1845a799d4ba2ac84bce30f > , which attempts to implement depth clamping (rather than clipping) > with shader tricks. > > You're forci

[Mesa-dev] Re mesa/st: add tgsi-lowering code for depth-clamp

2019-08-01 Thread Ilia Mirkin
Hey Gert, I'm looking at https://cgit.freedesktop.org/mesa/mesa/commit/?id=b048d8bf8f056759d1845a799d4ba2ac84bce30f , which attempts to implement depth clamping (rather than clipping) with shader tricks. You're forcing the final vertex stage's position's depth to 0, and then making up for it in