diff options
author | Dave Airlie <[email protected]> | 2020-04-15 10:43:52 +1000 |
---|---|---|
committer | Dave Airlie <[email protected]> | 2020-04-16 06:25:39 +1000 |
commit | f01c0565bb9ad7335395920aebc7489cb76d1b72 (patch) | |
tree | 70981a4aff2f88ba00f70f80d31e6bffca13b1bf /src/gallium/auxiliary | |
parent | 13ce637f1b28381e72470763ff5e39dd3c562476 (diff) |
draw: free the NIR IR.
Not sure how I missed this, the ownership was a bit blurry,
free the NIR.
Fixes: bf12bc2dd7a2 (draw: add nir info gathering and building support)
Reviewed-by: Roland Scheidegger <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4563>
Diffstat (limited to 'src/gallium/auxiliary')
-rw-r--r-- | src/gallium/auxiliary/draw/draw_gs.c | 5 | ||||
-rw-r--r-- | src/gallium/auxiliary/draw/draw_vs_llvm.c | 10 |
2 files changed, 11 insertions, 4 deletions
diff --git a/src/gallium/auxiliary/draw/draw_gs.c b/src/gallium/auxiliary/draw/draw_gs.c index 0cbead3f9ac..0c07d38e8b2 100644 --- a/src/gallium/auxiliary/draw/draw_gs.c +++ b/src/gallium/auxiliary/draw/draw_gs.c @@ -41,7 +41,7 @@ #include "util/u_math.h" #include "util/u_memory.h" #include "util/u_prim.h" - +#include "util/ralloc.h" /* fixme: move it from here */ #define MAX_PRIMITIVES 64 @@ -962,6 +962,9 @@ void draw_delete_geometry_shader(struct draw_context *draw, for (i = 0; i < TGSI_MAX_VERTEX_STREAMS; i++) FREE(dgs->stream[i].primitive_lengths); + + if (dgs->state.ir.nir) + ralloc_free(dgs->state.ir.nir); FREE((void*) dgs->state.tokens); FREE(dgs); } diff --git a/src/gallium/auxiliary/draw/draw_vs_llvm.c b/src/gallium/auxiliary/draw/draw_vs_llvm.c index e45fa68d5d6..ec3c5b00fbc 100644 --- a/src/gallium/auxiliary/draw/draw_vs_llvm.c +++ b/src/gallium/auxiliary/draw/draw_vs_llvm.c @@ -38,6 +38,8 @@ #include "tgsi/tgsi_parse.h" #include "tgsi/tgsi_scan.h" #include "nir/nir_to_tgsi_info.h" +#include "nir.h" + static void vs_llvm_prepare(struct draw_vertex_shader *shader, struct draw_context *draw) @@ -76,6 +78,8 @@ vs_llvm_delete( struct draw_vertex_shader *dvs ) } assert(shader->variants_cached == 0); + if (dvs->state.ir.nir) + ralloc_free(dvs->state.ir.nir); FREE((void*) dvs->state.tokens); FREE( dvs ); } @@ -92,9 +96,10 @@ draw_create_vs_llvm(struct draw_context *draw, /* due to some bugs in the feedback state tracker we have to check for ir.nir & PIPE_SHADER_IR_NIR here. */ - if (state->ir.nir && state->type == PIPE_SHADER_IR_NIR) + if (state->ir.nir && state->type == PIPE_SHADER_IR_NIR) { + vs->base.state.ir.nir = state->ir.nir; nir_tgsi_scan_shader(state->ir.nir, &vs->base.info, true); - else { + } else { /* we make a private copy of the tokens */ vs->base.state.tokens = tgsi_dup_tokens(state->tokens); if (!vs->base.state.tokens) { @@ -113,7 +118,6 @@ draw_create_vs_llvm(struct draw_context *draw, vs->base.info.file_max[TGSI_FILE_IMAGE]+1); vs->base.state.type = state->type; - vs->base.state.ir.nir = state->ir.nir; vs->base.state.stream_output = state->stream_output; vs->base.draw = draw; vs->base.prepare = vs_llvm_prepare; |