[Mesa-dev] [PATCH] nir: add helper to get # of dest components
Rob Clark
robdclark at gmail.com
Mon Apr 27 12:05:21 PDT 2015
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