summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2014-12-15 17:37:07 -0800
committerJason Ekstrand <[email protected]>2015-01-15 07:20:22 -0800
commit5c16be1c521e4bad670bc81134526a568b82a4a7 (patch)
treed154f9d2b7045555931c11e0c8d155c3b5fbf001
parent821e75a16038aba23aa0d46c081c99f07ee44ecd (diff)
nir/lower_system_values: Handle SSA destinations
Reviewed-by: Connor Abbott <[email protected]>
-rw-r--r--src/glsl/nir/nir_lower_system_values.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/glsl/nir/nir_lower_system_values.c b/src/glsl/nir/nir_lower_system_values.c
index 7bb02a77bd9..d1b4d26e2ae 100644
--- a/src/glsl/nir/nir_lower_system_values.c
+++ b/src/glsl/nir/nir_lower_system_values.c
@@ -69,7 +69,20 @@ convert_instr(nir_intrinsic_instr *instr)
}
nir_intrinsic_instr *new_instr = nir_intrinsic_instr_create(mem_ctx, op);
- new_instr->dest = nir_dest_copy(instr->dest, mem_ctx);
+
+ 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_src new_dest_src = {
+ .is_ssa = true,
+ .ssa = &new_instr->dest.ssa,
+ };
+ nir_ssa_def_rewrite_uses(&instr->dest.ssa, new_dest_src, mem_ctx);
+ } else {
+ new_instr->dest = nir_dest_copy(instr->dest, mem_ctx);
+ }
+
nir_instr_insert_before(&instr->instr, &new_instr->instr);
nir_instr_remove(&instr->instr);
}