summaryrefslogtreecommitdiffstats
path: root/src/glsl/nir/nir_lower_atomics.c
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2015-01-20 16:23:51 -0800
committerEric Anholt <[email protected]>2015-01-22 13:52:19 -0800
commit534a4ec82f09fa37e2134c994082e71c79b7d5ec (patch)
tree598ab6b45e9a47d997c7d09881a6bad54c805d45 /src/glsl/nir/nir_lower_atomics.c
parentc5be9c126d6ca9380cd381a5eb22554e4bb71a64 (diff)
nir: Make an easier helper for setting up SSA defs.
Almost all instructions we nir_ssa_def_init() for are nir_dests, and you have to keep from forgetting to set is_ssa when you do. Just provide the simpler helper, instead. Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src/glsl/nir/nir_lower_atomics.c')
-rw-r--r--src/glsl/nir/nir_lower_atomics.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/glsl/nir/nir_lower_atomics.c b/src/glsl/nir/nir_lower_atomics.c
index c45b397afba..ec582f306c3 100644
--- a/src/glsl/nir/nir_lower_atomics.c
+++ b/src/glsl/nir/nir_lower_atomics.c
@@ -86,8 +86,7 @@ lower_instr(nir_intrinsic_instr *instr, nir_function_impl *impl)
nir_instr_insert_before(&instr->instr, &atomic_counter_size->instr);
nir_alu_instr *mul = nir_alu_instr_create(mem_ctx, nir_op_imul);
- mul->dest.dest.is_ssa = true;
- nir_ssa_def_init(&mul->instr, &mul->dest.dest.ssa, 1, NULL);
+ nir_ssa_dest_init(&mul->instr, &mul->dest.dest, 1, NULL);
mul->dest.write_mask = 0x1;
mul->src[0].src = nir_src_copy(deref_array->indirect, mem_ctx);
mul->src[1].src.is_ssa = true;
@@ -95,8 +94,7 @@ lower_instr(nir_intrinsic_instr *instr, nir_function_impl *impl)
nir_instr_insert_before(&instr->instr, &mul->instr);
nir_alu_instr *add = nir_alu_instr_create(mem_ctx, nir_op_iadd);
- add->dest.dest.is_ssa = true;
- nir_ssa_def_init(&add->instr, &add->dest.dest.ssa, 1, NULL);
+ nir_ssa_dest_init(&add->instr, &add->dest.dest, 1, NULL);
add->dest.write_mask = 0x1;
add->src[0].src.is_ssa = true;
add->src[0].src.ssa = &mul->dest.dest.ssa;
@@ -112,9 +110,8 @@ lower_instr(nir_intrinsic_instr *instr, nir_function_impl *impl)
new_instr->src[0].ssa = offset_def;;
if (instr->dest.is_ssa) {
- new_instr->dest.is_ssa = true;
- nir_ssa_def_init(&new_instr->instr, &new_instr->dest.ssa,
- instr->dest.ssa.num_components, NULL);
+ nir_ssa_dest_init(&new_instr->instr, &new_instr->dest,
+ instr->dest.ssa.num_components, NULL);
nir_ssa_def_rewrite_uses(&instr->dest.ssa,
nir_src_for_ssa(&new_instr->dest.ssa),
mem_ctx);