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>
(cherry picked from commit 4b9aa9dc91)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38803>
This commit is contained in:
Lionel Landwerlin 2025-11-24 12:30:50 +02:00 committed by Dylan Baker
parent 97d5911e00
commit 142c392389
4 changed files with 8 additions and 1 deletions

View file

@ -2384,7 +2384,7 @@
"description": "nir/lower_printf: fix missing singleton add",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null,
"notes": null

View file

@ -76,6 +76,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

@ -329,6 +329,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;
@ -456,6 +457,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 = {
@ -320,6 +321,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);
@ -467,6 +469,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);
@ -475,6 +478,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);