summaryrefslogtreecommitdiff
path: root/src/mesa
diff options
context:
space:
mode:
authorKenneth Graunke <kenneth@whitecape.org>2010-06-25 14:10:01 -0700
committerIan Romanick <ian.d.romanick@intel.com>2010-06-30 13:52:24 -0700
commit116f1d4f95d8eb0a82b272016590549632c865b3 (patch)
tree320bfa5fc3869e5d2dd61ec21fbd09fae229e207 /src/mesa
parentef5f1948316664055c1444d12076c7d86589a8b9 (diff)
glsl2: Steal the live IR and free the rest of the junk.
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/shader/ir_to_mesa.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp
index 75021a70fd..c3de3aae05 100644
--- a/src/mesa/shader/ir_to_mesa.cpp
+++ b/src/mesa/shader/ir_to_mesa.cpp
@@ -1650,6 +1650,12 @@ get_mesa_program(GLcontext *ctx, void *mem_ctx, struct gl_shader *shader)
extern "C" {
+static void
+steal_memory(ir_instruction *ir, void *new_ctx)
+{
+ talloc_steal(new_ctx, ir);
+}
+
void
_mesa_glsl_compile_shader(GLcontext *ctx, struct gl_shader *shader)
{
@@ -1712,6 +1718,11 @@ _mesa_glsl_compile_shader(GLcontext *ctx, struct gl_shader *shader)
shader->CompileStatus = !state->error;
shader->InfoLog = state->info_log;
+ /* Retain any live IR, but trash the rest. */
+ foreach_list(node, shader->ir) {
+ visit_tree((ir_instruction *) node, steal_memory, shader);
+ }
+
talloc_free(state);
}