On 2 December 2013 11:31, Francisco Jerez <curroje...@riseup.net> wrote:

> Add assertion that the register is not in the HW_REG or IMM file,
> calculate the conjunction of the old and new mask instead of replacing
> the old [consistent with the behavior of brw_writemask(), causes no
> functional changes right now], make it static inline to let the
> compiler do a slightly better job at optimizing things, and shorten
> its name.
> ---
>  src/mesa/drivers/dri/i965/brw_vec4.h              |  9 +++++++--
>  src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp    | 11 +----------
>  src/mesa/drivers/dri/i965/brw_vec4_vs_visitor.cpp | 12 ++++++------
>  3 files changed, 14 insertions(+), 18 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_vec4.h
> b/src/mesa/drivers/dri/i965/brw_vec4.h
> index 19de4c6..50e4794 100644
> --- a/src/mesa/drivers/dri/i965/brw_vec4.h
> +++ b/src/mesa/drivers/dri/i965/brw_vec4.h
> @@ -192,8 +192,13 @@ offset(dst_reg reg, unsigned delta)
>     return reg;
>  }
>
> -dst_reg
> -with_writemask(dst_reg const &r, int mask);
> +static inline dst_reg
> +writemask(dst_reg reg, unsigned mask)
> +{
> +   assert(reg.file != HW_REG && reg.file != IMM);
> +   reg.writemask &= mask;
> +   return reg;
> +}
>

IIRC, hardware behaviour is undefined if the destination of an instruction
has a writemask of 0.  Should we add an assertion here to verify that the
new reg.writemask != 0?

With that addressed, this patch is:

Reviewed-by: Paul Berry <stereotype...@gmail.com>
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to