[Mesa-dev] [PATCH 1/2] i965: Add an is_negative_one() method.

Ian Romanick idr at freedesktop.org
Fri Feb 13 09:50:55 PST 2015


With Tom's indentation fixes in patch 2 applied, this series is

Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

On 02/12/2015 03:36 PM, Matt Turner wrote:
> ---
>  src/mesa/drivers/dri/i965/brw_shader.cpp | 16 ++++++++++++++++
>  src/mesa/drivers/dri/i965/brw_shader.h   |  1 +
>  2 files changed, 17 insertions(+)
> 
> diff --git a/src/mesa/drivers/dri/i965/brw_shader.cpp b/src/mesa/drivers/dri/i965/brw_shader.cpp
> index 8b87d0d..d7b9c44 100644
> --- a/src/mesa/drivers/dri/i965/brw_shader.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_shader.cpp
> @@ -734,6 +734,22 @@ backend_reg::is_one() const
>  }
>  
>  bool
> +backend_reg::is_negative_one() const
> +{
> +   if (file != IMM)
> +      return false;
> +
> +   switch (type) {
> +   case BRW_REGISTER_TYPE_F:
> +      return fixed_hw_reg.dw1.f == -1.0;
> +   case BRW_REGISTER_TYPE_D:
> +      return fixed_hw_reg.dw1.d == -1;
> +   default:
> +      return false;
> +   }
> +}
> +
> +bool
>  backend_reg::is_null() const
>  {
>     return file == HW_REG &&
> diff --git a/src/mesa/drivers/dri/i965/brw_shader.h b/src/mesa/drivers/dri/i965/brw_shader.h
> index 4b5c573..7bff186 100644
> --- a/src/mesa/drivers/dri/i965/brw_shader.h
> +++ b/src/mesa/drivers/dri/i965/brw_shader.h
> @@ -51,6 +51,7 @@ struct backend_reg
>  #ifdef __cplusplus
>     bool is_zero() const;
>     bool is_one() const;
> +   bool is_negative_one() const;
>     bool is_null() const;
>     bool is_accumulator() const;
>  #endif
> 



More information about the mesa-dev mailing list