From 116f1d4f95d8eb0a82b272016590549632c865b3 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Fri, 25 Jun 2010 14:10:01 -0700 Subject: glsl2: Steal the live IR and free the rest of the junk. --- src/glsl/main.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/glsl') diff --git a/src/glsl/main.cpp b/src/glsl/main.cpp index 1ed22e1f33..8b2eeaa13a 100644 --- a/src/glsl/main.cpp +++ b/src/glsl/main.cpp @@ -99,6 +99,12 @@ const struct option compiler_opts[] = { { NULL, 0, NULL, 0 } }; +static void +steal_memory(ir_instruction *ir, void *new_ctx) +{ + talloc_steal(new_ctx, ir); +} + void compile_shader(struct gl_shader *shader) { @@ -187,6 +193,11 @@ compile_shader(struct gl_shader *shader) 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); return; -- cgit v1.2.3