[Mesa-dev] [PATCH 2/9] spirv: Parent the nir_shader to the builder while building

Jason Ekstrand jason at jlekstrand.net
Thu Aug 17 17:22:16 UTC 2017


---
 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 7b34dad..e0d6c75a 100644
--- a/src/compiler/spirv/spirv_to_nir.c
+++ b/src/compiler/spirv/spirv_to_nir.c
@@ -3353,7 +3353,7 @@ spirv_to_nir(const uint32_t *words, size_t word_count,
       return NULL;
    }
 
-   b->shader = nir_shader_create(NULL, stage, options, NULL);
+   b->shader = nir_shader_create(b, stage, options, NULL);
 
    /* Set shader info defaults */
    b->shader->info.gs.invocations = 1;
@@ -3383,6 +3383,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;
-- 
2.5.0.400.gff86faf



More information about the mesa-dev mailing list