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

Roland Mainz roland.mainz at nrubsig.org
Mon Oct 10 21:36:24 UTC 2016


On Mon, Oct 10, 2016 at 6:12 PM, Ilia Mirkin <imirkin at alum.mit.edu> wrote:
> Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
> ---
>  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.mainz at nrubsig.org
  \__\/\/__/  MPEG specialist, C&&JAVA&&Sun&&Unix programmer
  /O /==\ O\  TEL +49 641 3992797
 (;O/ \/ \O;)


More information about the mesa-dev mailing list