ralloc_free(ctx.vars);
}
-void
+bool
ac_lower_indirect_derefs(struct nir_shader *nir, enum chip_class chip_class)
{
+ bool progress = false;
+
/* Lower large variables to scratch first so that we won't bloat the
* shader by generating large if ladders for them. We later lower
* scratch to alloca's, assuming LLVM won't generate VGPR indexing.
*/
- NIR_PASS_V(nir, nir_lower_vars_to_scratch,
- nir_var_function_temp,
- 256,
- glsl_get_natural_size_align_bytes);
+ NIR_PASS(progress, nir, nir_lower_vars_to_scratch,
+ nir_var_function_temp,
+ 256,
+ glsl_get_natural_size_align_bytes);
/* While it would be nice not to have this flag, we are constrained
* by the reality that LLVM 9.0 has buggy VGPR indexing on GFX9.
*/
indirect_mask |= nir_var_function_temp;
- nir_lower_indirect_derefs(nir, indirect_mask);
+ progress |= nir_lower_indirect_derefs(nir, indirect_mask);
+ return progress;
}
static unsigned
return (index * 4) + chan;
}
-void ac_lower_indirect_derefs(struct nir_shader *nir, enum chip_class);
+bool ac_lower_indirect_derefs(struct nir_shader *nir, enum chip_class);
bool ac_are_tessfactors_def_in_all_invocs(const struct nir_shader *nir);
*
* st/mesa calls finalize_nir twice, but we can't call this pass twice.
*/
+ bool changed = false;
if (!nir->constant_data) {
- NIR_PASS_V(nir, nir_opt_large_constants,
- glsl_get_natural_size_align_bytes, 16);
+ NIR_PASS(changed, nir, nir_opt_large_constants,
+ glsl_get_natural_size_align_bytes, 16);
}
- ac_lower_indirect_derefs(nir, sscreen->info.chip_class);
-
- si_nir_opts(nir);
+ changed |= ac_lower_indirect_derefs(nir, sscreen->info.chip_class);
+ if (changed)
+ si_nir_opts(nir);
NIR_PASS_V(nir, nir_lower_bool_to_int32);
NIR_PASS_V(nir, nir_remove_dead_variables, nir_var_function_temp);