Module: Mesa Branch: staging/23.3 Commit: 7d805b42da8568fa7a78e1a384d5c374e00243dc URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=7d805b42da8568fa7a78e1a384d5c374e00243dc
Author: Lionel Landwerlin <lionel.g.landwer...@intel.com> Date: Thu Oct 19 16:48:26 2023 +0300 nir/clone: fix missing printf_info clone Signed-off-by: Lionel Landwerlin <lionel.g.landwer...@intel.com> Cc: mesa-stable Reviewed-by: Karol Herbst <kher...@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26505> (cherry picked from commit 81b3dea9937baefd19d1791e1a592eec443f9085) --- .pick_status.json | 2 +- src/compiler/nir/nir_clone.c | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/.pick_status.json b/.pick_status.json index cdac2d5d571..5e9ca44e286 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -1044,7 +1044,7 @@ "description": "nir/clone: fix missing printf_info clone", "nominated": true, "nomination_type": 0, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null, "notes": null diff --git a/src/compiler/nir/nir_clone.c b/src/compiler/nir/nir_clone.c index 02571203c54..c8373bc7991 100644 --- a/src/compiler/nir/nir_clone.c +++ b/src/compiler/nir/nir_clone.c @@ -687,6 +687,32 @@ clone_function(clone_state *state, const nir_function *fxn, nir_shader *ns) return nfxn; } +static u_printf_info * +clone_printf_info(void *mem_ctx, const nir_shader *s) +{ + u_printf_info *infos = ralloc_array(mem_ctx, u_printf_info, s->printf_info_count); + + for (unsigned i = 0; i < s->printf_info_count; i++) { + const u_printf_info *src_info = &s->printf_info[i]; + + infos[i].num_args = src_info->num_args; + infos[i].arg_sizes = ralloc_size(mem_ctx, + sizeof(infos[i].arg_sizes[0]) * + src_info->num_args); + memcpy(infos[i].arg_sizes, src_info->arg_sizes, + sizeof(infos[i].arg_sizes[0]) * src_info->num_args); + + + infos[i].string_size = src_info->string_size; + infos[i].strings = ralloc_size(mem_ctx, + src_info->string_size); + memcpy(infos[i].strings, src_info->strings, + src_info->string_size); + } + + return infos; +} + nir_shader * nir_shader_clone(void *mem_ctx, const nir_shader *s) { @@ -734,6 +760,11 @@ nir_shader_clone(void *mem_ctx, const nir_shader *s) memcpy(ns->xfb_info, s->xfb_info, size); } + if (s->printf_info_count > 0) { + ns->printf_info = clone_printf_info(ns, s); + ns->printf_info_count = s->printf_info_count; + } + free_clone_state(&state); return ns;