nir/algebraic: trivially enable existing 32-bit patterns for all bit sizes
[mesa.git] / src / compiler / nir / nir_lower_atomics_to_ssbo.c
index a72c20e54910ef4c8e469abc30b7a189a2049bde..b9ba4e4b273a6a6ad994ff3837fe26af6887eb19 100644 (file)
@@ -127,10 +127,16 @@ lower_instr(nir_intrinsic_instr *instr, unsigned ssbo_offset, nir_builder *b)
       break;
    }
 
-   if (new_instr->intrinsic == nir_intrinsic_load_ssbo ||
-       new_instr->intrinsic == nir_intrinsic_store_ssbo)
+   if (new_instr->intrinsic == nir_intrinsic_load_ssbo) {
       nir_intrinsic_set_align(new_instr, 4, 0);
 
+      /* we could be replacing an intrinsic with fixed # of dest
+       * num_components with one that has variable number.  So
+       * best to take this from the dest:
+       */
+      new_instr->num_components = instr->dest.ssa.num_components;
+   }
+
    nir_ssa_dest_init(&new_instr->instr, &new_instr->dest,
                      instr->dest.ssa.num_components,
                      instr->dest.ssa.bit_size, NULL);
@@ -145,11 +151,6 @@ lower_instr(nir_intrinsic_instr *instr, unsigned ssbo_offset, nir_builder *b)
       nir_ssa_def_rewrite_uses(&instr->dest.ssa, nir_src_for_ssa(&new_instr->dest.ssa));
    }
 
-   /* we could be replacing an intrinsic with fixed # of dest num_components
-    * with one that has variable number.  So best to take this from the dest:
-    */
-   new_instr->num_components = instr->dest.ssa.num_components;
-
    return true;
 }
 
@@ -187,7 +188,7 @@ nir_lower_atomics_to_ssbo(nir_shader *shader)
    if (progress) {
       /* replace atomic_uint uniforms with ssbo's: */
       unsigned replaced = 0;
-      nir_foreach_variable_safe(var, &shader->uniforms) {
+      nir_foreach_uniform_variable_safe(var, shader) {
          if (is_atomic_uint(var->type)) {
             exec_node_remove(&var->node);