glsl/nir: Include early glsl-to-nir output in NIR_DEBUG=print.

These passes were missing the macros to handle debug output and extra
validation.  But also, for working on GLSL, it's nice to see the raw
output of glsl-to-nir before you move on.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21751>
This commit is contained in:
Emma Anholt 2023-03-06 16:15:16 -08:00 committed by Marge Bot
parent a10388224d
commit dccbecbef5

View file

@ -228,15 +228,19 @@ glsl_to_nir(const struct gl_constants *consts,
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");