[Mesa-dev] [PATCH] radeonsi: compute the absolute value before RSQ

Samuel Pitoiset samuel.pitoiset at gmail.com
Thu Jan 5 19:47:19 UTC 2017



On 01/05/2017 08:32 PM, Kenneth Graunke wrote:
> On Thursday, January 5, 2017 5:47:37 PM PST Samuel Pitoiset wrote:
>> As explained by Nicolai, it seems like D3D always compute the
>> absolute value while GLSL says that the result of inversesqrt()
>> is undefined if x <= 0. Using the absolute value looks like safer
>> especially when the game has been ported from D3D to GL.
>>
>> This gets rid of the NaN values in the "Spec Ops: The Line" game
>> as well as the black squares.
>>
>> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97338
>>
>> Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
>> ---
>>
>> Nouveau also computes the absolute value before emitting RSQ.
>>
>
> Would it make sense to just make the GLSL sqrt() and inversesqrt()
> functions take the absolute value, so we do this for all drivers?
> abs is cheap...

I would say yes, but I think we need more feedbacks. :)

If you guys do agree, I could make a v2 of that patch in the GLSL compiler.

>
> --Ken
>


More information about the mesa-dev mailing list