[Mesa-dev] Mesa (master): tgsi: add support for flt64 constants

Brian Paul brianp at vmware.com
Fri Feb 20 07:15:08 PST 2015


On 02/19/2015 03:53 PM, Dave Airlie wrote:
> Module: Mesa
> Branch: master
> Commit: fa43e0443e206740e219d45abefee65bdb2c3ecb
> URL:    https://urldefense.proofpoint.com/v2/url?u=http-3A__cgit.freedesktop.org_mesa_mesa_commit_-3Fid-3Dfa43e0443e206740e219d45abefee65bdb2c3ecb&d=AwIGaQ&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=T0t4QG7chq2ZwJo6wilkFznRSFy-8uDKartPGbomVj8&m=wliriAj2Oy285HDmqyh5ciHQpkhmeNqaYMAXn6TDVgo&s=QfqfqTGO4IS5Ib7ukIrfSIR3EGdcXECY38l_K3GlYlo&e=
>
> Author: Dave Airlie <airlied at redhat.com>
> Date:   Wed Aug 27 09:56:14 2014 +1000
>
> tgsi: add support for flt64 constants
>
> These act like flt32 except they take up two slots, and you
> can only add 2 x flt64 constants in one slot.
>
> The main reason they are different is we don't want to match half a flt64
> constants against a flt32 constant in the matching code, we need to make
> sure we treat both parts of the flt64 as an single structure.
>
> Cleaned up printing/parsing by Ilia Mirkin <imirkin at alum.mit.edu>
>
> Reviewed-by: Ilia Mirkin <imirkin at alum.mit.edu>
> Signed-off-by: Dave Airlie <airlied at redhat.com>
>
> ---
>
>   src/gallium/auxiliary/tgsi/tgsi_dump.c     |    8 +++
>   src/gallium/auxiliary/tgsi/tgsi_parse.c    |    1 +
>   src/gallium/auxiliary/tgsi/tgsi_strings.c  |    5 +-
>   src/gallium/auxiliary/tgsi/tgsi_strings.h  |    2 +-
>   src/gallium/auxiliary/tgsi/tgsi_text.c     |   22 ++++++++
>   src/gallium/auxiliary/tgsi/tgsi_ureg.c     |   75 ++++++++++++++++++++++++++--
>   src/gallium/auxiliary/tgsi/tgsi_ureg.h     |    5 ++
>   src/gallium/include/pipe/p_shader_tokens.h |    1 +
>   8 files changed, 113 insertions(+), 6 deletions(-)
>

[...]

> diff --git a/src/gallium/auxiliary/tgsi/tgsi_text.c b/src/gallium/auxiliary/tgsi/tgsi_text.c
> index f965b01..5069d13 100644
> --- a/src/gallium/auxiliary/tgsi/tgsi_text.c
> +++ b/src/gallium/auxiliary/tgsi/tgsi_text.c
> @@ -232,6 +232,24 @@ static boolean parse_float( const char **pcur, float *val )
>      return TRUE;
>   }
>
> +static boolean parse_double( const char **pcur, uint32_t *val0, uint32_t *val1)
> +{
> +   const char *cur = *pcur;
> +   union {
> +      double dval;
> +      uint32_t uval[2];
> +   } v;
> +
> +   v.dval = strtod(cur, pcur);
> +   if (*pcur == cur)
> +      return FALSE;
> +
> +   *val0 = v.uval[0];
> +   *val1 = v.uval[1];
> +
> +   return TRUE;
> +}

Hi Dave, I'm seeing a new compiler warning in that code:

tgsi/tgsi_text.c: In function 'parse_double':
tgsi/tgsi_text.c:243:4: warning: passing argument 2 of 'strtod' from 
incompatible pointer type [enabled by default]
     v.dval = strtod(cur, pcur);
     ^
In file included from ../../../src/gallium/include/pipe/p_compiler.h:36:0,
                  from ./os/os_misc.h:38,
                  from ./util/u_debug.h:42,
                  from tgsi/tgsi_text.c:28:
/usr/include/stdlib.h:164:15: note: expected 'char ** restrict' but 
argument is of type 'const char **'
  extern double strtod (const char *__restrict __nptr,
                ^

Can you clean that up?

gcc 4.8.2

-Brian





More information about the mesa-dev mailing list