summaryrefslogtreecommitdiffstats
path: root/src/glsl/nir/nir.h
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2015-04-21 18:00:21 -0700
committerJason Ekstrand <[email protected]>2015-05-08 17:16:13 -0700
commit300d72943675a49091ecb49597b56f7bdfefd22d (patch)
tree9efa3cfdbeeed2f59a99432681b503c4c965ecc1 /src/glsl/nir/nir.h
parent6702ebce5760aae0eb15f410c2a83b6e893b005c (diff)
nir: Add and use initializer #defines for nir_src and nir_dest
Reviewed-by: Connor Abbott <[email protected]>
Diffstat (limited to 'src/glsl/nir/nir.h')
-rw-r--r--src/glsl/nir/nir.h13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/glsl/nir/nir.h b/src/glsl/nir/nir.h
index 98b0ec3287c..a174666e0e4 100644
--- a/src/glsl/nir/nir.h
+++ b/src/glsl/nir/nir.h
@@ -497,6 +497,8 @@ typedef struct nir_src {
bool is_ssa;
} nir_src;
+#define NIR_SRC_INIT (nir_src) { { { NULL } } }
+
typedef struct {
union {
nir_reg_dest reg;
@@ -506,10 +508,12 @@ typedef struct {
bool is_ssa;
} nir_dest;
+#define NIR_DEST_INIT (nir_dest) { { { NULL } } }
+
static inline nir_src
nir_src_for_ssa(nir_ssa_def *def)
{
- nir_src src;
+ nir_src src = NIR_SRC_INIT;
src.is_ssa = true;
src.ssa = def;
@@ -520,7 +524,7 @@ nir_src_for_ssa(nir_ssa_def *def)
static inline nir_src
nir_src_for_reg(nir_register *reg)
{
- nir_src src;
+ nir_src src = NIR_SRC_INIT;
src.is_ssa = false;
src.reg.reg = reg;
@@ -543,12 +547,9 @@ nir_src_get_parent_instr(const nir_src *src)
static inline nir_dest
nir_dest_for_reg(nir_register *reg)
{
- nir_dest dest;
+ nir_dest dest = NIR_DEST_INIT;
- dest.is_ssa = false;
dest.reg.reg = reg;
- dest.reg.indirect = NULL;
- dest.reg.base_offset = 0;
return dest;
}