Re: [Mesa-dev] [PATCH 05/22] glsl: Add sqrt, rsq, exp, exp2 to get_range

2015-01-18 Thread Marek Olšák
gl_Position.z isn't bound by any range. It doesn't have to be clipped (it can be clamped instead), but if it's clipped, the value outside of the range still affects the whole primitive that can be at least partially visible. Marek On Sat, Jan 17, 2015 at 5:07 PM, Thomas Helland

Re: [Mesa-dev] [PATCH 05/22] glsl: Add sqrt, rsq, exp, exp2 to get_range

2015-01-17 Thread Thomas Helland
I see why you are worried, and I agree 100%. This just reinforces my impression that expanding this pass does not give adequate return on investment. If we had even better coverage we just might get some advantage, but even then I have a bad feeling about this. Do you have any suggestions for

Re: [Mesa-dev] [PATCH 05/22] glsl: Add sqrt, rsq, exp, exp2 to get_range

2015-01-11 Thread Marek Olšák
Well, max(x, 0) has no effect on NaNs. According to the GLSL specification, max() should return x if either argument is NaN. So the correct way to convert NaN to 0 is: max(0, y) That implies that min and max aren't commutative if NaNs are supported. Marek On Fri, Jan 9, 2015 at 4:15 AM, Connor

Re: [Mesa-dev] [PATCH 05/22] glsl: Add sqrt, rsq, exp, exp2 to get_range

2015-01-11 Thread Marek Olšák
Also, you seem to be assuming that IEEE and D3D10 versions of the min() and max() are the same, which is not true. Both GLSL and D3D10 versions should work according to IEEE754, yet they are different. The GLSL versions use conditional assignments, which is the same as C. The D3D10 versions are

Re: [Mesa-dev] [PATCH 05/22] glsl: Add sqrt, rsq, exp, exp2 to get_range

2015-01-11 Thread Connor Abbott
On Sun, Jan 11, 2015 at 6:57 AM, Marek Olšák mar...@gmail.com wrote: Well, max(x, 0) has no effect on NaNs. According to the GLSL specification, max() should return x if either argument is NaN. So the correct way to convert NaN to 0 is: max(0, y) That implies that min and max aren't

Re: [Mesa-dev] [PATCH 05/22] glsl: Add sqrt, rsq, exp, exp2 to get_range

2015-01-08 Thread Connor Abbott
On Sat, Jan 3, 2015 at 2:18 PM, Thomas Helland thomashellan...@gmail.com wrote: Also handle undefined behaviour for sqrt(x) where x 0 and rsq(x) where x = 0. This gives us some reduction in instruction count on three Dungeon Defenders shaders as they are doing: max(exp(x), 0) So initially

[Mesa-dev] [PATCH 05/22] glsl: Add sqrt, rsq, exp, exp2 to get_range

2015-01-03 Thread Thomas Helland
Also handle undefined behaviour for sqrt(x) where x 0 and rsq(x) where x = 0. This gives us some reduction in instruction count on three Dungeon Defenders shaders as they are doing: max(exp(x), 0) v2: Change to use new IS_CONSTANT() macro Fix high unintenionally not being returned Add