Mesa (master): mesa: Hang the compiled shader off the shader->ir, not the shader.

Eric Anholt anholt at kemper.freedesktop.org
Wed Aug 18 21:20:37 UTC 2010


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

Author: Eric Anholt <eric at anholt.net>
Date:   Wed Aug 18 11:36:09 2010 -0700

mesa: Hang the compiled shader off the shader->ir, not the shader.

Otherwise, with repeated program recompile, we never free the results
of the previous compile.

---

 src/mesa/program/ir_to_mesa.cpp |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp
index 58d3b41..8ed3834 100644
--- a/src/mesa/program/ir_to_mesa.cpp
+++ b/src/mesa/program/ir_to_mesa.cpp
@@ -2662,6 +2662,7 @@ _mesa_glsl_compile_shader(GLcontext *ctx, struct gl_shader *shader)
      _mesa_glsl_lexer_dtor(state);
    }
 
+   talloc_free(shader->ir);
    shader->ir = new(shader) exec_list;
    if (!state->error && !state->translation_unit.is_empty())
       _mesa_ast_to_hir(shader->ir, state);
@@ -2706,7 +2707,7 @@ _mesa_glsl_compile_shader(GLcontext *ctx, struct gl_shader *shader)
    }
 
    /* Retain any live IR, but trash the rest. */
-   reparent_ir(shader->ir, shader);
+   reparent_ir(shader->ir, shader->ir);
 
    talloc_free(state);
 




More information about the mesa-commit mailing list