nir/lower_printf: fix missing singleton add

If we're using the singleton, we need to add to it.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Cc: mesa-stable
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38638>
This commit is contained in:
Lionel Landwerlin 2025-11-24 12:30:50 +02:00 committed by Marge Bot
parent d24633023f
commit 4b9aa9dc91
3 changed files with 7 additions and 0 deletions

View file

@ -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;
}

View file

@ -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);

View file

@ -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 <sys/mman.h>
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);