aboutsummaryrefslogtreecommitdiffstats
path: root/src/glsl
diff options
context:
space:
mode:
authorSamuel Iglesias Gonsalvez <[email protected]>2015-09-23 08:48:21 +0200
committerSamuel Iglesias Gonsalvez <[email protected]>2015-09-25 08:39:22 +0200
commit3e70c968de363168fc491ca673a4798284a10c44 (patch)
treea28aed68b047a17fadd41c12ef045d5bdf4c7bf2 /src/glsl
parent922b3d1bb16b4b6b292cb159e5fe3d0615ca725c (diff)
nir: modify the instruction insertion in nir_visitor::visit(ir_call *ir)
This patch moves nir_instr_insert_after_cf_list call into each case in the intrinsics switch at nir_visitor::visit(ir_call *ir) and define a nir_dest variable which will be used when handling ir->return_deref after the switch. This patch simplifies the code for nir_intrinsic_load_ssbo implementation changes we are going to do next. Reviewed-by: Kristian Høgsberg <[email protected]>
Diffstat (limited to 'src/glsl')
-rw-r--r--src/glsl/nir/glsl_to_nir.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/glsl/nir/glsl_to_nir.cpp b/src/glsl/nir/glsl_to_nir.cpp
index add6b6261b4..d0b769a9c13 100644
--- a/src/glsl/nir/glsl_to_nir.cpp
+++ b/src/glsl/nir/glsl_to_nir.cpp
@@ -656,6 +656,7 @@ nir_visitor::visit(ir_call *ir)
}
nir_intrinsic_instr *instr = nir_intrinsic_instr_create(shader, op);
+ nir_dest *dest = &instr->dest;
switch (op) {
case nir_intrinsic_atomic_counter_read_var:
@@ -665,6 +666,7 @@ nir_visitor::visit(ir_call *ir)
(ir_dereference *) ir->actual_parameters.get_head();
instr->variables[0] = evaluate_deref(&instr->instr, param);
nir_ssa_dest_init(&instr->instr, &instr->dest, 1, NULL);
+ nir_instr_insert_after_cf_list(this->cf_node_list, &instr->instr);
break;
}
case nir_intrinsic_image_load:
@@ -702,8 +704,10 @@ nir_visitor::visit(ir_call *ir)
}
if (op == nir_intrinsic_image_size ||
- op == nir_intrinsic_image_samples)
+ op == nir_intrinsic_image_samples) {
+ nir_instr_insert_after_cf_list(this->cf_node_list, &instr->instr);
break;
+ }
/* Set the address argument, extending the coordinate vector to four
* components.
@@ -745,9 +749,11 @@ nir_visitor::visit(ir_call *ir)
instr->src[3] = evaluate_rvalue((ir_dereference *)param);
param = param->get_next();
}
+ nir_instr_insert_after_cf_list(this->cf_node_list, &instr->instr);
break;
}
case nir_intrinsic_memory_barrier:
+ nir_instr_insert_after_cf_list(this->cf_node_list, &instr->instr);
break;
case nir_intrinsic_store_ssbo: {
exec_node *param = ir->actual_parameters.get_head();
@@ -771,6 +777,7 @@ nir_visitor::visit(ir_call *ir)
instr = nir_intrinsic_instr_create(shader, op);
instr->src[2] = evaluate_rvalue(offset);
instr->const_index[0] = 0;
+ dest = &instr->dest;
} else {
instr->const_index[0] = const_offset->value.u[0];
}
@@ -781,14 +788,13 @@ nir_visitor::visit(ir_call *ir)
instr->num_components = val->type->vector_elements;
instr->src[1] = evaluate_rvalue(block);
+ nir_instr_insert_after_cf_list(this->cf_node_list, &instr->instr);
break;
}
default:
unreachable("not reached");
}
- nir_instr_insert_after_cf_list(this->cf_node_list, &instr->instr);
-
if (ir->return_deref) {
nir_intrinsic_instr *store_instr =
nir_intrinsic_instr_create(shader, nir_intrinsic_store_var);
@@ -796,7 +802,7 @@ nir_visitor::visit(ir_call *ir)
store_instr->variables[0] =
evaluate_deref(&store_instr->instr, ir->return_deref);
- store_instr->src[0] = nir_src_for_ssa(&instr->dest.ssa);
+ store_instr->src[0] = nir_src_for_ssa(&dest->ssa);
nir_instr_insert_after_cf_list(this->cf_node_list,
&store_instr->instr);