summaryrefslogtreecommitdiffstats
path: root/src/glsl/ir.cpp
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2010-07-20 11:27:38 -0700
committerIan Romanick <[email protected]>2010-07-20 17:48:24 -0700
commit60e2d06d1ccc66ad00cd7ab81c418853f21be291 (patch)
treef464e04e73a934858b92153b35ae5c1a79f7c426 /src/glsl/ir.cpp
parent2462a536ea5c98867296905e3da127eba7c7bdff (diff)
glsl2: Implement utility routine to talloc reparent an IR tree
Diffstat (limited to 'src/glsl/ir.cpp')
-rw-r--r--src/glsl/ir.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp
index 146ff17af31..a2732962f03 100644
--- a/src/glsl/ir.cpp
+++ b/src/glsl/ir.cpp
@@ -875,3 +875,18 @@ visit_exec_list(exec_list *list, ir_visitor *visitor)
}
}
+
+static void
+steal_memory(ir_instruction *ir, void *new_ctx)
+{
+ talloc_steal(new_ctx, ir);
+}
+
+
+void
+reparent_ir(exec_list *list, void *mem_ctx)
+{
+ foreach_list(node, list) {
+ visit_tree((ir_instruction *) node, steal_memory, mem_ctx);
+ }
+}