gtn: use const_index helpers
authorRob Clark <robclark@freedesktop.org>
Thu, 21 Jan 2016 18:32:09 +0000 (13:32 -0500)
committerRob Clark <robclark@freedesktop.org>
Tue, 9 Feb 2016 22:30:33 +0000 (17:30 -0500)
Signed-off-by: Rob Clark <robclark@freedesktop.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
src/compiler/nir/glsl_to_nir.cpp

index 3db27751289d7bd85839f2f4da28f79627903b8c..68b7aebbc37c6a98db0fee1210d0a90b9aeebf34 100644 (file)
@@ -585,7 +585,7 @@ nir_visitor::visit(ir_emit_vertex *ir)
 {
    nir_intrinsic_instr *instr =
       nir_intrinsic_instr_create(this->shader, nir_intrinsic_emit_vertex);
-   instr->const_index[0] = ir->stream_id();
+   nir_intrinsic_set_stream_id(instr, ir->stream_id());
    nir_builder_instr_insert(&b, &instr->instr);
 }
 
@@ -594,7 +594,7 @@ nir_visitor::visit(ir_end_primitive *ir)
 {
    nir_intrinsic_instr *instr =
       nir_intrinsic_instr_create(this->shader, nir_intrinsic_end_primitive);
-   instr->const_index[0] = ir->stream_id();
+   nir_intrinsic_set_stream_id(instr, ir->stream_id());
    nir_builder_instr_insert(&b, &instr->instr);
 }
 
@@ -874,7 +874,7 @@ nir_visitor::visit(ir_call *ir)
          instr->src[0] = nir_src_for_ssa(evaluate_rvalue(val));
          instr->src[1] = nir_src_for_ssa(evaluate_rvalue(block));
          instr->src[2] = nir_src_for_ssa(evaluate_rvalue(offset));
-         instr->const_index[0] = write_mask->value.u[0];
+         nir_intrinsic_set_write_mask(instr, write_mask->value.u[0]);
          instr->num_components = val->type->vector_elements;
 
          nir_builder_instr_insert(&b, &instr->instr);
@@ -972,7 +972,7 @@ nir_visitor::visit(ir_call *ir)
          exec_node *param = ir->actual_parameters.get_head();
          ir_rvalue *offset = ((ir_instruction *)param)->as_rvalue();
 
-         instr->const_index[0] = 0;
+         nir_intrinsic_set_base(instr, 0);
          instr->src[0] = nir_src_for_ssa(evaluate_rvalue(offset));
 
          const glsl_type *type = ir->return_deref->var->type;
@@ -996,10 +996,10 @@ nir_visitor::visit(ir_call *ir)
          ir_constant *write_mask = ((ir_instruction *)param)->as_constant();
          assert(write_mask);
 
-         instr->const_index[0] = 0;
+         nir_intrinsic_set_base(instr, 0);
          instr->src[1] = nir_src_for_ssa(evaluate_rvalue(offset));
 
-         instr->const_index[1] = write_mask->value.u[0];
+         nir_intrinsic_set_write_mask(instr, write_mask->value.u[0]);
 
          instr->src[0] = nir_src_for_ssa(evaluate_rvalue(val));
          instr->num_components = val->type->vector_elements;
@@ -1054,7 +1054,8 @@ nir_visitor::visit(ir_call *ir)
          nir_intrinsic_instr *store_instr =
             nir_intrinsic_instr_create(shader, nir_intrinsic_store_var);
          store_instr->num_components = ir->return_deref->type->vector_elements;
-         store_instr->const_index[0] = (1 << store_instr->num_components) - 1;
+         nir_intrinsic_set_write_mask(store_instr,
+                                      (1 << store_instr->num_components) - 1);
 
          store_instr->variables[0] =
             evaluate_deref(&store_instr->instr, ir->return_deref);
@@ -1132,7 +1133,7 @@ nir_visitor::visit(ir_assignment *ir)
    nir_intrinsic_instr *store =
       nir_intrinsic_instr_create(this->shader, nir_intrinsic_store_var);
    store->num_components = ir->lhs->type->vector_elements;
-   store->const_index[0] = ir->write_mask;
+   nir_intrinsic_set_write_mask(store, ir->write_mask);
    nir_deref *store_deref = nir_copy_deref(store, &lhs_deref->deref);
    store->variables[0] = nir_deref_as_var(store_deref);
    store->src[0] = nir_src_for_ssa(src);