From dccbecbef5bb216052c4796227b09f8517c8e4be Mon Sep 17 00:00:00 2001 From: Emma Anholt Date: Mon, 6 Mar 2023 16:15:16 -0800 Subject: [PATCH] glsl/nir: Include early glsl-to-nir output in NIR_DEBUG=print. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Timothy Arceri Reviewed-by: Marek Olšák Part-of: --- src/compiler/glsl/glsl_to_nir.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/compiler/glsl/glsl_to_nir.cpp b/src/compiler/glsl/glsl_to_nir.cpp index 2c39fb2..9f79119 100644 --- a/src/compiler/glsl/glsl_to_nir.cpp +++ b/src/compiler/glsl/glsl_to_nir.cpp @@ -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"); -- 2.7.4