[Mesa-dev] [PATCH 48/95] i965/vec4: add a force_vstride0 flag to src_reg

Francisco Jerez currojerez at riseup.net
Mon Sep 12 21:05:11 UTC 2016


Iago Toral Quiroga <itoral at igalia.com> writes:

> We will use this in cases where we want to force the vstride of a src_reg
> to 0 to exploit a particular behavior of the hardware. It will come in
> handy to implement access to components Z/W.
> ---
>  src/mesa/drivers/dri/i965/brw_ir_vec4.h | 1 +
>  src/mesa/drivers/dri/i965/brw_vec4.cpp  | 2 ++
>  2 files changed, 3 insertions(+)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_ir_vec4.h b/src/mesa/drivers/dri/i965/brw_ir_vec4.h
> index f66c093..f3cce4b 100644
> --- a/src/mesa/drivers/dri/i965/brw_ir_vec4.h
> +++ b/src/mesa/drivers/dri/i965/brw_ir_vec4.h
> @@ -51,6 +51,7 @@ public:
>     explicit src_reg(const dst_reg &reg);
>  
>     src_reg *reladdr;
> +   bool force_vstride0;

I was wondering whether it would make more sense to unify this with the
FS back-end's fs_reg::stride (a numeric stride field is also likely more
convenient to do arithmetic on than a boolean) and promote it to
backend_reg?  It could be defined as the number of components to jump
over for each logical channel of the register, which is just the vstride
in single-precision SIMD4x2 and the hstride in scalar mode.

But thinking about it some more, I wonder if it's really necessary to
expose vertical strides at the IR level?  Aren't you planing to use this
during the conversion to HW registers exclusively?  Why don't you set
the vstride field directly in that case?

>  };
>  
>  static inline src_reg
> diff --git a/src/mesa/drivers/dri/i965/brw_vec4.cpp b/src/mesa/drivers/dri/i965/brw_vec4.cpp
> index a20b2fd..bfbbd96 100644
> --- a/src/mesa/drivers/dri/i965/brw_vec4.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_vec4.cpp
> @@ -70,6 +70,7 @@ src_reg::src_reg(struct ::brw_reg reg) :
>  {
>     this->reg_offset = 0;
>     this->reladdr = NULL;
> +   this->force_vstride0 = false;
>  }
>  
>  src_reg::src_reg(const dst_reg &reg) :
> @@ -77,6 +78,7 @@ src_reg::src_reg(const dst_reg &reg) :
>  {
>     this->reladdr = reg.reladdr;
>     this->swizzle = brw_swizzle_for_mask(reg.writemask);
> +   this->force_vstride0 = false;
>  }
>  
>  void
> -- 
> 2.7.4
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 212 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20160912/0035e636/attachment.sig>


More information about the mesa-dev mailing list