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

2017-01-05 Thread Roland Scheidegger
Am 06.01.2017 um 00:00 schrieb Marek Olšák: > On Thu, Jan 5, 2017 at 10:06 PM, Roland Scheidegger > wrote: >> Am 05.01.2017 um 21:50 schrieb Samuel Pitoiset: >>> >>> >>> On 01/05/2017 09:44 PM, Marek Olšák wrote: On Thu, Jan 5, 2017 at 9:00 PM, Roland Scheidegger wrote: > Am 05.01.

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

2017-01-05 Thread Marek Olšák
On Thu, Jan 5, 2017 at 10:06 PM, Roland Scheidegger wrote: > Am 05.01.2017 um 21:50 schrieb Samuel Pitoiset: >> >> >> On 01/05/2017 09:44 PM, Marek Olšák wrote: >>> On Thu, Jan 5, 2017 at 9:00 PM, Roland Scheidegger >>> wrote: Am 05.01.2017 um 20:43 schrieb Samuel Pitoiset: > > >

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

2017-01-05 Thread Samuel Pitoiset
On 01/05/2017 10:06 PM, Roland Scheidegger wrote: Am 05.01.2017 um 21:50 schrieb Samuel Pitoiset: On 01/05/2017 09:44 PM, Marek Olšák wrote: On Thu, Jan 5, 2017 at 9:00 PM, Roland Scheidegger wrote: Am 05.01.2017 um 20:43 schrieb Samuel Pitoiset: On 01/05/2017 06:49 PM, Roland Scheideg

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

2017-01-05 Thread Roland Scheidegger
Am 05.01.2017 um 21:50 schrieb Samuel Pitoiset: > > > On 01/05/2017 09:44 PM, Marek Olšák wrote: >> On Thu, Jan 5, 2017 at 9:00 PM, Roland Scheidegger >> wrote: >>> Am 05.01.2017 um 20:43 schrieb Samuel Pitoiset: On 01/05/2017 06:49 PM, Roland Scheidegger wrote: > Meh, I'm not

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

2017-01-05 Thread Samuel Pitoiset
On 01/05/2017 09:44 PM, Marek Olšák wrote: On Thu, Jan 5, 2017 at 9:00 PM, Roland Scheidegger wrote: Am 05.01.2017 um 20:43 schrieb Samuel Pitoiset: On 01/05/2017 06:49 PM, Roland Scheidegger wrote: Meh, I'm not really a big fan of such hacks. GPUs have support for NaNs since ages, and wh

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

2017-01-05 Thread Marek Olšák
On Thu, Jan 5, 2017 at 9:00 PM, Roland Scheidegger wrote: > Am 05.01.2017 um 20:43 schrieb Samuel Pitoiset: >> >> >> On 01/05/2017 06:49 PM, Roland Scheidegger wrote: >>> Meh, I'm not really a big fan of such hacks. GPUs have support for NaNs >>> since ages, and while glsl is lenient the point sta

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

2017-01-05 Thread Roland Scheidegger
Am 05.01.2017 um 20:43 schrieb Samuel Pitoiset: > > > On 01/05/2017 06:49 PM, Roland Scheidegger wrote: >> Meh, I'm not really a big fan of such hacks. GPUs have support for NaNs >> since ages, and while glsl is lenient the point stands that returning a >> NaN is a more correct result, so doing e

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

2017-01-05 Thread Samuel Pitoiset
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

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

2017-01-05 Thread Samuel Pitoiset
On 01/05/2017 06:49 PM, Roland Scheidegger wrote: Meh, I'm not really a big fan of such hacks. GPUs have support for NaNs since ages, and while glsl is lenient the point stands that returning a NaN is a more correct result, so doing extra work to get a wrong result doesn't look all that great t

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

2017-01-05 Thread Samuel Pitoiset
On 01/05/2017 06:37 PM, Marek Olšák wrote: Shouldn't we also use abs for SQRT? For example, this adds abs for both RSQ and SQRT: https://cgit.freedesktop.org/~mareko/mesa/commit/?id=5e0fb661a8e6ac5f7b2245dd31595155128e0664 Yes, it makes more sense to do it for both even if we don't have any

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

2017-01-05 Thread Kenneth Graunke
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 bee

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

2017-01-05 Thread Roland Scheidegger
Meh, I'm not really a big fan of such hacks. GPUs have support for NaNs since ages, and while glsl is lenient the point stands that returning a NaN is a more correct result, so doing extra work to get a wrong result doesn't look all that great to me. FWIW dx10 requires NaNs as results (for both sqr

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

2017-01-05 Thread Marek Olšák
Shouldn't we also use abs for SQRT? For example, this adds abs for both RSQ and SQRT: https://cgit.freedesktop.org/~mareko/mesa/commit/?id=5e0fb661a8e6ac5f7b2245dd31595155128e0664 Marek On Thu, Jan 5, 2017 at 5:47 PM, Samuel Pitoiset wrote: > As explained by Nicolai, it seems like D3D always co

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

2017-01-05 Thread Samuel Pitoiset
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: