diff options
author | Ian Romanick <[email protected]> | 2010-07-20 11:27:38 -0700 |
---|---|---|
committer | Ian Romanick <[email protected]> | 2010-07-20 17:48:24 -0700 |
commit | 60e2d06d1ccc66ad00cd7ab81c418853f21be291 (patch) | |
tree | f464e04e73a934858b92153b35ae5c1a79f7c426 /src/glsl/ir.cpp | |
parent | 2462a536ea5c98867296905e3da127eba7c7bdff (diff) |
glsl2: Implement utility routine to talloc reparent an IR tree
Diffstat (limited to 'src/glsl/ir.cpp')
-rw-r--r-- | src/glsl/ir.cpp | 15 |
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); + } +} |