spirv: Parent the nir_shader to the builder while building
authorJason Ekstrand <jason.ekstrand@intel.com>
Wed, 16 Aug 2017 15:43:08 +0000 (08:43 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Mon, 4 Dec 2017 17:21:09 +0000 (09:21 -0800)
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Ian Romanick <idr@freedesktop.org>
src/compiler/spirv/spirv_to_nir.c

index b36772caad19d41f5be3bc32518683f5f0e484c2..353d99cc613b2781fdf3a4b393cfd7028280a821 100644 (file)
@@ -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;