From 956f17395bfcf7f8ce9dd5ac9fd14a13e86f3a8f Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Wed, 14 Mar 2018 21:44:51 -0700 Subject: [PATCH] nir: Add src/dest num_components helpers We already have these for bit_size Reviewed-by: Kenneth Graunke --- src/compiler/nir/nir.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h index 9fff1f4647d..5ba6a1f0687 100644 --- a/src/compiler/nir/nir.h +++ b/src/compiler/nir/nir.h @@ -631,12 +631,24 @@ nir_src_bit_size(nir_src src) return src.is_ssa ? src.ssa->bit_size : src.reg.reg->bit_size; } +static inline unsigned +nir_src_num_components(nir_src src) +{ + return src.is_ssa ? src.ssa->num_components : src.reg.reg->num_components; +} + static inline unsigned nir_dest_bit_size(nir_dest dest) { return dest.is_ssa ? dest.ssa.bit_size : dest.reg.reg->bit_size; } +static inline unsigned +nir_dest_num_components(nir_dest dest) +{ + return dest.is_ssa ? dest.ssa.num_components : dest.reg.reg->num_components; +} + void nir_src_copy(nir_src *dest, const nir_src *src, void *instr_or_if); void nir_dest_copy(nir_dest *dest, const nir_dest *src, nir_instr *instr); -- 2.30.2