From 4b9aa9dc91c5deb18c4e5b4e0c2e50012a8663d1 Mon Sep 17 00:00:00 2001 From: Lionel Landwerlin Date: Mon, 24 Nov 2025 12:30:50 +0200 Subject: [PATCH] nir/lower_printf: fix missing singleton add If we're using the singleton, we need to add to it. Signed-off-by: Lionel Landwerlin Cc: mesa-stable Reviewed-by: Alyssa Rosenzweig Reviewed-by: Boris Brezillon Part-of: --- src/compiler/nir/nir_lower_printf.c | 1 + src/compiler/spirv/vtn_bindgen2.c | 2 ++ src/panfrost/clc/pan_compile.c | 4 ++++ 3 files changed, 7 insertions(+) diff --git a/src/compiler/nir/nir_lower_printf.c b/src/compiler/nir/nir_lower_printf.c index cfe9b7c0252..098ecd47e75 100644 --- a/src/compiler/nir/nir_lower_printf.c +++ b/src/compiler/nir/nir_lower_printf.c @@ -75,6 +75,7 @@ lower_printf_intrin(nir_builder *b, nir_intrinsic_instr *prntf, void *_options) */ assert(fmt_str_id - 1 < b->shader->printf_info_count && "must be in-bounds"); + u_printf_singleton_add(&b->shader->printf_info[fmt_str_id - 1], 1); uint32_t hash = u_printf_hash(&b->shader->printf_info[fmt_str_id - 1]); fmt_str_id = hash; } diff --git a/src/compiler/spirv/vtn_bindgen2.c b/src/compiler/spirv/vtn_bindgen2.c index 37d55dc4554..b41d2fa811f 100644 --- a/src/compiler/spirv/vtn_bindgen2.c +++ b/src/compiler/spirv/vtn_bindgen2.c @@ -330,6 +330,7 @@ main(int argc, char **argv) } glsl_type_singleton_init_or_ref(); + u_printf_singleton_init_or_ref(); for (unsigned i = 0; i < 2; ++i) { FILE *fp = i ? fp_c : fp_h; @@ -457,6 +458,7 @@ main(int argc, char **argv) fprintf(fp_c, " static vtn_bindgen_dummy vtn_bindgen_dummy_instance;\n"); fprintf(fp_c, "}\n"); + u_printf_singleton_decref(); glsl_type_singleton_decref(); fclose(fp_c); fclose(fp_h); diff --git a/src/panfrost/clc/pan_compile.c b/src/panfrost/clc/pan_compile.c index 5e30968416e..c6325828ead 100644 --- a/src/panfrost/clc/pan_compile.c +++ b/src/panfrost/clc/pan_compile.c @@ -27,6 +27,7 @@ #include "panfrost/util/pan_ir.h" #include "util/macros.h" #include "util/u_dynarray.h" +#include "util/u_printf.h" #include static const struct spirv_to_nir_options spirv_options = { @@ -314,6 +315,7 @@ main(int argc, const char **argv) } glsl_type_singleton_init_or_ref(); + u_printf_singleton_init_or_ref(); /* POSIX basename can modify the content of the path */ char *tmp_out_h_path = strdup(output_h_path); @@ -461,6 +463,7 @@ main(int argc, const char **argv) nir_precomp_print_binary_map(fp_c, nir, library_name, target_name, remap_variant); + u_printf_singleton_decref(); glsl_type_singleton_decref(); fclose(fp_c); fclose(fp_h); @@ -469,6 +472,7 @@ main(int argc, const char **argv) return 0; invalid_precomp: + u_printf_singleton_decref(); glsl_type_singleton_decref(); fp_c_open_failed: fclose(fp_h);