glsl/nir: Include early glsl-to-nir output in NIR_DEBUG=print.
authorEmma Anholt <emma@anholt.net>
Tue, 7 Mar 2023 00:15:16 +0000 (16:15 -0800)
committerMarge Bot <emma+marge@anholt.net>
Wed, 15 Mar 2023 03:29:19 +0000 (03:29 +0000)
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>

src/compiler/glsl/glsl_to_nir.cpp

index 2c39fb2..9f79119 100644 (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");