sh->ir = NULL;
nir_validate_shader(shader, "after glsl to nir, before function inline");
+ if (should_print_nir(shader)) {
+ printf("glsl_to_nir\n");
+ nir_print_shader(shader, stdout);
+ }
/* We have to lower away local constant initializers right before we
* inline functions. That way they get properly initialized at the top
* of the function and not at the top of its caller.
*/
- nir_lower_variable_initializers(shader, nir_var_all);
- nir_lower_returns(shader);
- nir_inline_functions(shader);
- nir_opt_deref(shader);
+ NIR_PASS_V(shader, nir_lower_variable_initializers, nir_var_all);
+ NIR_PASS_V(shader, nir_lower_returns);
+ NIR_PASS_V(shader, nir_inline_functions);
+ NIR_PASS_V(shader, nir_opt_deref);
nir_validate_shader(shader, "after function inlining and return lowering");