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

Dave Airlie airlied at gmail.com
Mon Oct 10 19:59:46 UTC 2016


On 11 October 2016 at 02:12, 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(-)

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 <airlied at redhat.com>
>
> 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 at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list