anv,i965: Lower away image derefs in the driver
[mesa.git] / src / compiler / nir / nir_lower_alu_to_scalar.c
index a0377dcb0be9b2c59feacadcb7a226116333ec70..742c8d8ee666b4d0ac6b056febd29137794a006c 100644 (file)
@@ -209,9 +209,9 @@ lower_alu_instr_scalar(nir_alu_instr *instr, nir_builder *b)
       return false;
 
    unsigned num_components = instr->dest.dest.ssa.num_components;
-   nir_ssa_def *comps[] = { NULL, NULL, NULL, NULL };
+   nir_ssa_def *comps[NIR_MAX_VEC_COMPONENTS] = { NULL };
 
-   for (chan = 0; chan < 4; chan++) {
+   for (chan = 0; chan < NIR_MAX_VEC_COMPONENTS; chan++) {
       if (!(instr->dest.write_mask & (1 << chan)))
          continue;
 
@@ -225,7 +225,7 @@ lower_alu_instr_scalar(nir_alu_instr *instr, nir_builder *b)
                               0 : chan);
 
          nir_alu_src_copy(&lower->src[i], &instr->src[i], lower);
-         for (int j = 0; j < 4; j++)
+         for (int j = 0; j < NIR_MAX_VEC_COMPONENTS; j++)
             lower->src[i].swizzle[j] = instr->src[i].swizzle[src_chan];
       }