Module: Mesa
Branch: main
Commit: 43c3f4386bf290d48877a42f741e31b34c902d92
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=43c3f4386bf290d48877a42f741e31b34c902d92

Author: Karol Herbst <[email protected]>
Date:   Sat Mar 19 16:36:46 2022 +0100

nir: fix nir_sweep for printf

I hit a memory corruption trying to implement printf for Rusticl

Signed-off-by: Karol Herbst <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15474>

---

 src/compiler/nir/nir_sweep.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/compiler/nir/nir_sweep.c b/src/compiler/nir/nir_sweep.c
index 0c5c71ad970..d931556cffc 100644
--- a/src/compiler/nir/nir_sweep.c
+++ b/src/compiler/nir/nir_sweep.c
@@ -163,6 +163,11 @@ nir_sweep(nir_shader *nir)
    assert(list_is_empty(&instr_gc_list));
 
    ralloc_steal(nir, nir->constant_data);
+   ralloc_steal(nir, nir->printf_info);
+   for (int i = 0; i < nir->printf_info_count; i++) {
+      ralloc_steal(nir, nir->printf_info[i].arg_sizes);
+      ralloc_steal(nir, nir->printf_info[i].strings);
+   }
 
    /* Free everything we didn't steal back. */
    ralloc_free(rubbish);

Reply via email to