[Mesa-dev] [PATCH] tgsi/ureg: make the dst register match the src indirection

Jose Fonseca jfonseca at vmware.com
Fri May 3 06:15:41 PDT 2013


----- Original Message -----
> In ureg src registers could have an indirect register that was
> either a temp or an addr register, while dst registers allowed
> only addr. That made moving between them a little difficult so
> make them behave the same way and allow temp's and addr registers
> as indirect files for both (tgsi supports it, just ureg didn't).
> 
> Signed-off-by: Zack Rusin <zackr at vmware.com>
> ---
>  src/gallium/auxiliary/tgsi/tgsi_ureg.c |    3 ++-
>  src/gallium/auxiliary/tgsi/tgsi_ureg.h |   14 ++++++++++----
>  2 files changed, 12 insertions(+), 5 deletions(-)
> 
> diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.c
> b/src/gallium/auxiliary/tgsi/tgsi_ureg.c
> index 5a28b89..432ed00 100644
> --- a/src/gallium/auxiliary/tgsi/tgsi_ureg.c
> +++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.c
> @@ -258,6 +258,7 @@ ureg_dst_register( unsigned file,
>     dst.File      = file;
>     dst.WriteMask = TGSI_WRITEMASK_XYZW;
>     dst.Indirect  = 0;
> +   dst.IndirectFile = TGSI_FILE_NULL;
>     dst.IndirectIndex = 0;
>     dst.IndirectSwizzle = 0;
>     dst.Saturate  = 0;
> @@ -943,7 +944,7 @@ ureg_emit_dst( struct ureg_program *ureg,
>     
>     if (dst.Indirect) {
>        out[n].value = 0;
> -      out[n].ind.File = TGSI_FILE_ADDRESS;
> +      out[n].ind.File = dst.IndirectFile;
>        out[n].ind.Swizzle = dst.IndirectSwizzle;
>        out[n].ind.Index = dst.IndirectIndex;
>        out[n].ind.ArrayID = dst.ArrayID;
> diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.h
> b/src/gallium/auxiliary/tgsi/tgsi_ureg.h
> index 4ad0242..1d7923b 100644
> --- a/src/gallium/auxiliary/tgsi/tgsi_ureg.h
> +++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.h
> @@ -83,7 +83,8 @@ struct ureg_dst
>     unsigned PredSwizzleZ    : 2;  /* TGSI_SWIZZLE_ */
>     unsigned PredSwizzleW    : 2;  /* TGSI_SWIZZLE_ */
>     int      Index           : 16; /* SINT */
> -   int      IndirectIndex   : 16; /* SINT */
> +   int      IndirectIndex   : 12; /* SINT */

I think it's better to keep IndirectIndex the same size, to match ureg_src.

ureg_src already is bigger than 64bits, and things still work, so I see no benefit in handicapping ureg_dst

Otherwise looks good to me.

Jose


More information about the mesa-dev mailing list