nir/lower_double_ops: lower trunc()
[mesa.git] / src / compiler / nir / nir_lower_var_copies.c
index 8cb3edd0a845086ef2a7ca6122b3e5d0ce6c1bf0..a5e3805f1bebd3f05014047db37a77e9d36a46f1 100644 (file)
@@ -116,19 +116,22 @@ emit_copy_load_store(nir_intrinsic_instr *copy_instr,
       assert(src_tail->type == dest_tail->type);
 
       unsigned num_components = glsl_get_vector_elements(src_tail->type);
+      unsigned bit_size =
+         glsl_get_bit_size(glsl_get_base_type(src_tail->type));
 
       nir_intrinsic_instr *load =
          nir_intrinsic_instr_create(mem_ctx, nir_intrinsic_load_var);
       load->num_components = num_components;
       load->variables[0] = nir_deref_as_var(nir_copy_deref(load, &src_head->deref));
-      nir_ssa_dest_init(&load->instr, &load->dest, num_components, NULL);
+      nir_ssa_dest_init(&load->instr, &load->dest, num_components, bit_size,
+                        NULL);
 
       nir_instr_insert_before(&copy_instr->instr, &load->instr);
 
       nir_intrinsic_instr *store =
          nir_intrinsic_instr_create(mem_ctx, nir_intrinsic_store_var);
       store->num_components = num_components;
-      store->const_index[0] = (1 << num_components) - 1;
+      nir_intrinsic_set_write_mask(store, (1 << num_components) - 1);
       store->variables[0] = nir_deref_as_var(nir_copy_deref(store, &dest_head->deref));
 
       store->src[0].is_ssa = true;
@@ -174,7 +177,7 @@ lower_var_copies_block(nir_block *block, void *mem_ctx)
 static void
 lower_var_copies_impl(nir_function_impl *impl)
 {
-   nir_foreach_block(impl, lower_var_copies_block, ralloc_parent(impl));
+   nir_foreach_block_call(impl, lower_var_copies_block, ralloc_parent(impl));
 }
 
 /* Lowers every copy_var instruction in the program to a sequence of