From 72bd3a60043188ff0d28a3132f393915ab197532 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Fri, 24 Jan 2025 16:54:26 -0500 Subject: [PATCH] nir: include __LINE__ in NIR_PASS validation results useful when validation blows up in a file containing many intrinsic passes, to figure out which one is borked. Signed-off-by: Alyssa Rosenzweig Acked-by: Timothy Arceri Part-of: --- src/compiler/nir/nir.h | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h index f21b598a8bd..0f2a7507974 100644 --- a/src/compiler/nir/nir.h +++ b/src/compiler/nir/nir.h @@ -5406,18 +5406,21 @@ should_print_nir(UNUSED nir_shader *shader) } \ } while (0) -#define NIR_PASS(progress, nir, pass, ...) _PASS(pass, nir, { \ - nir_metadata_set_validation_flag(nir); \ - if (should_print_nir(nir)) \ - printf("%s\n", #pass); \ - if (pass(nir, ##__VA_ARGS__)) { \ - nir_validate_shader(nir, "after " #pass " in " __FILE__); \ - UNUSED bool _; \ - progress = true; \ - if (should_print_nir(nir)) \ - nir_print_shader(nir, stdout); \ - nir_metadata_check_validation_flag(nir); \ - } \ +#define NIR_STRINGIZE_INNER(x) #x +#define NIR_STRINGIZE(x) NIR_STRINGIZE_INNER(x) + +#define NIR_PASS(progress, nir, pass, ...) _PASS(pass, nir, { \ + nir_metadata_set_validation_flag(nir); \ + if (should_print_nir(nir)) \ + printf("%s\n", #pass); \ + if (pass(nir, ##__VA_ARGS__)) { \ + nir_validate_shader(nir, "after " #pass " in " __FILE__ ":" NIR_STRINGIZE(__LINE__)); \ + UNUSED bool _; \ + progress = true; \ + if (should_print_nir(nir)) \ + nir_print_shader(nir, stdout); \ + nir_metadata_check_validation_flag(nir); \ + } \ }) #define NIR_PASS_V(nir, pass, ...) _PASS(pass, nir, { \