Mesa (master): spirv: Parent the nir_shader to the builder while building

Jason Ekstrand jekstrand at kemper.freedesktop.org
Mon Dec 4 17:21:22 UTC 2017


Module: Mesa
Branch: master
Commit: d74bec1a544e8d2df5e92504bd095a542bb8a4ac
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=d74bec1a544e8d2df5e92504bd095a542bb8a4ac

Author: Jason Ekstrand <jason.ekstrand at intel.com>
Date:   Wed Aug 16 08:43:08 2017 -0700

spirv: Parent the nir_shader to the builder while building

Reviewed-by: Tapani Pälli <tapani.palli at intel.com>
Reviewed-by: Ian Romanick <idr at freedesktop.org>

---

 src/compiler/spirv/spirv_to_nir.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c
index b36772caad..353d99cc61 100644
--- a/src/compiler/spirv/spirv_to_nir.c
+++ b/src/compiler/spirv/spirv_to_nir.c
@@ -3351,7 +3351,7 @@ spirv_to_nir(const uint32_t *words, size_t word_count,
       return NULL;
    }
 
-   b->shader = nir_shader_create(NULL, stage, nir_options, NULL);
+   b->shader = nir_shader_create(b, stage, nir_options, NULL);
 
    /* Set shader info defaults */
    b->shader->info.gs.invocations = 1;
@@ -3390,6 +3390,9 @@ spirv_to_nir(const uint32_t *words, size_t word_count,
    nir_function *entry_point = b->entry_point->func->impl->function;
    assert(entry_point);
 
+   /* Unparent the shader from the vtn_builder before we delete the builder */
+   ralloc_steal(NULL, b->shader);
+
    ralloc_free(b);
 
    return entry_point;




More information about the mesa-commit mailing list