Re: [Mesa-dev] [PATCH] tgsi: fix parsing nan float inputs

2016-10-10 Thread Roland Scheidegger
Am 10.10.2016 um 23:57 schrieb Roland Mainz:
> On Mon, Oct 10, 2016 at 11:40 PM, Ilia Mirkin  wrote:
>> On Mon, Oct 10, 2016 at 5:36 PM, Roland Mainz  
>> wrote:
>>> On Mon, Oct 10, 2016 at 6:12 PM, Ilia Mirkin  wrote:
 Signed-off-by: Ilia Mirkin 
 ---
  src/gallium/auxiliary/tgsi/tgsi_text.c | 7 ++-
  1 file changed, 6 insertions(+), 1 deletion(-)

 diff --git a/src/gallium/auxiliary/tgsi/tgsi_text.c 
 b/src/gallium/auxiliary/tgsi/tgsi_text.c
 index be80842..36dc979 100644
 --- a/src/gallium/auxiliary/tgsi/tgsi_text.c
 +++ b/src/gallium/auxiliary/tgsi/tgsi_text.c
 @@ -257,8 +257,13 @@ static boolean parse_float( const char **pcur, float 
 *val )
  cur++;
}
 }
 -   if (!integral_part && !fractional_part)
 +   if (!integral_part && !fractional_part) {
 +  if (uprcase(*cur++) == 'N' &&
 +  uprcase(*cur++) == 'A' &&
 +  uprcase(*cur++) == 'N')
 + goto out;
return FALSE;
 +   }
 if (uprcase( *cur ) == 'E') {
cur++;
if (*cur == '-' || *cur == '+')
>>>
>>> Not digging around in the code... but...
>>> ... do you handle -nan and +nan ?
>>
>> Further up:
>>
>>*val = (float) atof( cur );
>>if (*cur == '-' || *cur == '+')
>>   cur++;
> 
> Thanks... :-)
> 
>> I'd kinda prefer to use strtof() and get rid of this function. Does
>> that work on MSVC?
> 
> No idea... ;-(
> 

According to docs, it should work starting with msvc 12.0 (vs 2013).

Roland


___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] tgsi: fix parsing nan float inputs

2016-10-10 Thread Roland Mainz
On Mon, Oct 10, 2016 at 11:40 PM, Ilia Mirkin  wrote:
> On Mon, Oct 10, 2016 at 5:36 PM, Roland Mainz  
> wrote:
>> On Mon, Oct 10, 2016 at 6:12 PM, Ilia Mirkin  wrote:
>>> Signed-off-by: Ilia Mirkin 
>>> ---
>>>  src/gallium/auxiliary/tgsi/tgsi_text.c | 7 ++-
>>>  1 file changed, 6 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/src/gallium/auxiliary/tgsi/tgsi_text.c 
>>> b/src/gallium/auxiliary/tgsi/tgsi_text.c
>>> index be80842..36dc979 100644
>>> --- a/src/gallium/auxiliary/tgsi/tgsi_text.c
>>> +++ b/src/gallium/auxiliary/tgsi/tgsi_text.c
>>> @@ -257,8 +257,13 @@ static boolean parse_float( const char **pcur, float 
>>> *val )
>>>  cur++;
>>>}
>>> }
>>> -   if (!integral_part && !fractional_part)
>>> +   if (!integral_part && !fractional_part) {
>>> +  if (uprcase(*cur++) == 'N' &&
>>> +  uprcase(*cur++) == 'A' &&
>>> +  uprcase(*cur++) == 'N')
>>> + goto out;
>>>return FALSE;
>>> +   }
>>> if (uprcase( *cur ) == 'E') {
>>>cur++;
>>>if (*cur == '-' || *cur == '+')
>>
>> Not digging around in the code... but...
>> ... do you handle -nan and +nan ?
>
> Further up:
>
>*val = (float) atof( cur );
>if (*cur == '-' || *cur == '+')
>   cur++;

Thanks... :-)

> I'd kinda prefer to use strtof() and get rid of this function. Does
> that work on MSVC?

No idea... ;-(



Bye,
Roland

-- 
  __ .  . __
 (o.\ \/ /.o) roland.ma...@nrubsig.org
  \__\/\/__/  MPEG specialist, C&&& programmer
  /O /==\ O\  TEL +49 641 3992797
 (;O/ \/ \O;)
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] tgsi: fix parsing nan float inputs

2016-10-10 Thread Ilia Mirkin
On Mon, Oct 10, 2016 at 5:36 PM, Roland Mainz  wrote:
> On Mon, Oct 10, 2016 at 6:12 PM, Ilia Mirkin  wrote:
>> Signed-off-by: Ilia Mirkin 
>> ---
>>  src/gallium/auxiliary/tgsi/tgsi_text.c | 7 ++-
>>  1 file changed, 6 insertions(+), 1 deletion(-)
>>
>> diff --git a/src/gallium/auxiliary/tgsi/tgsi_text.c 
>> b/src/gallium/auxiliary/tgsi/tgsi_text.c
>> index be80842..36dc979 100644
>> --- a/src/gallium/auxiliary/tgsi/tgsi_text.c
>> +++ b/src/gallium/auxiliary/tgsi/tgsi_text.c
>> @@ -257,8 +257,13 @@ static boolean parse_float( const char **pcur, float 
>> *val )
>>  cur++;
>>}
>> }
>> -   if (!integral_part && !fractional_part)
>> +   if (!integral_part && !fractional_part) {
>> +  if (uprcase(*cur++) == 'N' &&
>> +  uprcase(*cur++) == 'A' &&
>> +  uprcase(*cur++) == 'N')
>> + goto out;
>>return FALSE;
>> +   }
>> if (uprcase( *cur ) == 'E') {
>>cur++;
>>if (*cur == '-' || *cur == '+')
>
> Not digging around in the code... but...
> ... do you handle -nan and +nan ?

Further up:

   *val = (float) atof( cur );
   if (*cur == '-' || *cur == '+')
  cur++;

I'd kinda prefer to use strtof() and get rid of this function. Does
that work on MSVC?

>
> 
>
> Bye,
> Roland
>
> --
>   __ .  . __
>  (o.\ \/ /.o) roland.ma...@nrubsig.org
>   \__\/\/__/  MPEG specialist, C&&& programmer
>   /O /==\ O\  TEL +49 641 3992797
>  (;O/ \/ \O;)
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] tgsi: fix parsing nan float inputs

2016-10-10 Thread Roland Mainz
On Mon, Oct 10, 2016 at 6:12 PM, Ilia Mirkin  wrote:
> Signed-off-by: Ilia Mirkin 
> ---
>  src/gallium/auxiliary/tgsi/tgsi_text.c | 7 ++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/src/gallium/auxiliary/tgsi/tgsi_text.c 
> b/src/gallium/auxiliary/tgsi/tgsi_text.c
> index be80842..36dc979 100644
> --- a/src/gallium/auxiliary/tgsi/tgsi_text.c
> +++ b/src/gallium/auxiliary/tgsi/tgsi_text.c
> @@ -257,8 +257,13 @@ static boolean parse_float( const char **pcur, float 
> *val )
>  cur++;
>}
> }
> -   if (!integral_part && !fractional_part)
> +   if (!integral_part && !fractional_part) {
> +  if (uprcase(*cur++) == 'N' &&
> +  uprcase(*cur++) == 'A' &&
> +  uprcase(*cur++) == 'N')
> + goto out;
>return FALSE;
> +   }
> if (uprcase( *cur ) == 'E') {
>cur++;
>if (*cur == '-' || *cur == '+')

Not digging around in the code... but...
... do you handle -nan and +nan ?



Bye,
Roland

-- 
  __ .  . __
 (o.\ \/ /.o) roland.ma...@nrubsig.org
  \__\/\/__/  MPEG specialist, C&&& programmer
  /O /==\ O\  TEL +49 641 3992797
 (;O/ \/ \O;)
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] tgsi: fix parsing nan float inputs

2016-10-10 Thread Ilia Mirkin
On Mon, Oct 10, 2016 at 3:59 PM, Dave Airlie  wrote:
> On 11 October 2016 at 02:12, Ilia Mirkin  wrote:
>> Signed-off-by: Ilia Mirkin 
>> ---
>>  src/gallium/auxiliary/tgsi/tgsi_text.c | 7 ++-
>>  1 file changed, 6 insertions(+), 1 deletion(-)
>
> Is this a problem you've seen somewhere, it's why in virgl I ended up
> dumping as hex for flt values.

nouveau_compiler accepts text tgsi shaders.

>
> Reviewed-by: Dave Airlie 
>>
>> diff --git a/src/gallium/auxiliary/tgsi/tgsi_text.c 
>> b/src/gallium/auxiliary/tgsi/tgsi_text.c
>> index be80842..36dc979 100644
>> --- a/src/gallium/auxiliary/tgsi/tgsi_text.c
>> +++ b/src/gallium/auxiliary/tgsi/tgsi_text.c
>> @@ -257,8 +257,13 @@ static boolean parse_float( const char **pcur, float 
>> *val )
>>  cur++;
>>}
>> }
>> -   if (!integral_part && !fractional_part)
>> +   if (!integral_part && !fractional_part) {
>> +  if (uprcase(*cur++) == 'N' &&
>> +  uprcase(*cur++) == 'A' &&
>> +  uprcase(*cur++) == 'N')
>> + goto out;
>>return FALSE;
>> +   }
>> if (uprcase( *cur ) == 'E') {
>>cur++;
>>if (*cur == '-' || *cur == '+')
>> --
>> 2.7.3
>>
>> ___
>> mesa-dev mailing list
>> mesa-dev@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] tgsi: fix parsing nan float inputs

2016-10-10 Thread Dave Airlie
On 11 October 2016 at 02:12, Ilia Mirkin  wrote:
> Signed-off-by: Ilia Mirkin 
> ---
>  src/gallium/auxiliary/tgsi/tgsi_text.c | 7 ++-
>  1 file changed, 6 insertions(+), 1 deletion(-)

Is this a problem you've seen somewhere, it's why in virgl I ended up
dumping as hex for flt values.

Reviewed-by: Dave Airlie 
>
> diff --git a/src/gallium/auxiliary/tgsi/tgsi_text.c 
> b/src/gallium/auxiliary/tgsi/tgsi_text.c
> index be80842..36dc979 100644
> --- a/src/gallium/auxiliary/tgsi/tgsi_text.c
> +++ b/src/gallium/auxiliary/tgsi/tgsi_text.c
> @@ -257,8 +257,13 @@ static boolean parse_float( const char **pcur, float 
> *val )
>  cur++;
>}
> }
> -   if (!integral_part && !fractional_part)
> +   if (!integral_part && !fractional_part) {
> +  if (uprcase(*cur++) == 'N' &&
> +  uprcase(*cur++) == 'A' &&
> +  uprcase(*cur++) == 'N')
> + goto out;
>return FALSE;
> +   }
> if (uprcase( *cur ) == 'E') {
>cur++;
>if (*cur == '-' || *cur == '+')
> --
> 2.7.3
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev