[Mesa-dev] [PATCH] nir: add helper to get # of dest components

Connor Abbott cwabbott0 at gmail.com
Mon Apr 27 12:11:40 PDT 2015


When you push this, can you make sure there are users for it so it
isn't just dead code? Either in your driver, or there are probably
several places in core NIR where we currently open-code this.
Otherwise,

Reviewed-by: Connor Abbott <cwabbott0 at gmail.com>

On Mon, Apr 27, 2015 at 3:05 PM, Rob Clark <robdclark at gmail.com> wrote:
> From: Rob Clark <robclark at freedesktop.org>
>
> I need something like this in a couple places.  And didn't see anything
> like it anywhere.
>
> Signed-off-by: Rob Clark <robclark at freedesktop.org>
> ---
>  src/glsl/nir/nir.h | 9 +++++++++
>  1 file changed, 9 insertions(+)
>
> diff --git a/src/glsl/nir/nir.h b/src/glsl/nir/nir.h
> index 98b0ec3..3a96d56 100644
> --- a/src/glsl/nir/nir.h
> +++ b/src/glsl/nir/nir.h
> @@ -506,6 +506,15 @@ typedef struct {
>     bool is_ssa;
>  } nir_dest;
>
> +static inline unsigned
> +nir_dest_num_components(nir_dest *dest)
> +{
> +   if (dest->is_ssa)
> +      return dest->ssa.num_components;
> +   else
> +      return dest->reg.reg->num_components;
> +}
> +
>  static inline nir_src
>  nir_src_for_ssa(nir_ssa_def *def)
>  {
> --
> 2.3.5
>


More information about the mesa-dev mailing list