summaryrefslogtreecommitdiffstats
path: root/src/glsl/nir/glsl_to_nir.cpp
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2014-12-15 17:32:56 -0800
committerJason Ekstrand <[email protected]>2015-01-15 07:20:22 -0800
commit2c7da78805175f36879111306ac37c12d33bf65b (patch)
tree5fbfa3578dae242c5fa29cf46c647af351fda881 /src/glsl/nir/glsl_to_nir.cpp
parent675ffdef3010400567a5f6f790f1f7bd2fede717 (diff)
nir: Make load_const SSA-only
As it was, we weren't ever using load_const in a non-SSA way. This allows us to substantially simplify the load_const instruction. If we ever need a non-SSA constant load, we can do a load_const and an imov. Reviewed-by: Connor Abbott <[email protected]>
Diffstat (limited to 'src/glsl/nir/glsl_to_nir.cpp')
-rw-r--r--src/glsl/nir/glsl_to_nir.cpp12
1 files changed, 2 insertions, 10 deletions
diff --git a/src/glsl/nir/glsl_to_nir.cpp b/src/glsl/nir/glsl_to_nir.cpp
index 78070afe8e5..d0737d01db1 100644
--- a/src/glsl/nir/glsl_to_nir.cpp
+++ b/src/glsl/nir/glsl_to_nir.cpp
@@ -776,7 +776,6 @@ get_instr_dest(nir_instr *instr)
nir_alu_instr *alu_instr;
nir_intrinsic_instr *intrinsic_instr;
nir_tex_instr *tex_instr;
- nir_load_const_instr *load_const_instr;
switch (instr->type) {
case nir_instr_type_alu:
@@ -794,10 +793,6 @@ get_instr_dest(nir_instr *instr)
tex_instr = nir_instr_as_tex(instr);
return &tex_instr->dest;
- case nir_instr_type_load_const:
- load_const_instr = nir_instr_as_load_const(instr);
- return &load_const_instr->dest;
-
default:
assert(0);
break;
@@ -910,18 +905,15 @@ nir_visitor::visit(ir_expression *ir)
*/
if (ir->type->base_type == GLSL_TYPE_BOOL) {
- nir_load_const_instr *const_zero = nir_load_const_instr_create(shader);
- const_zero->num_components = 1;
+ nir_load_const_instr *const_zero = nir_load_const_instr_create(shader, 1);
const_zero->value.u[0] = 0;
- const_zero->dest.is_ssa = true;
- nir_ssa_def_init(&const_zero->instr, &const_zero->dest.ssa, 1, NULL);
nir_instr_insert_after_cf_list(this->cf_node_list, &const_zero->instr);
nir_alu_instr *compare = nir_alu_instr_create(shader, nir_op_ine);
compare->src[0].src.is_ssa = true;
compare->src[0].src.ssa = &load->dest.ssa;
compare->src[1].src.is_ssa = true;
- compare->src[1].src.ssa = &const_zero->dest.ssa;
+ compare->src[1].src.ssa = &const_zero->def;
for (unsigned i = 0; i < ir->type->vector_elements; i++)
compare->src[1].swizzle[i] = 0;
compare->dest.write_mask = (1 << ir->type->vector_elements) - 1;