}
}
+
+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);
+ }
+}
_mesa_glsl_initialize_functions(exec_list *instructions,
struct _mesa_glsl_parse_state *state);
+extern void
+reparent_ir(exec_list *list, void *mem_ctx);
+
#endif /* IR_H */
{ 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)
{
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);
- }
+ reparent_ir(shader->ir, shader);
talloc_free(state);
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)
{
shader->Version = state->language_version;
/* Retain any live IR, but trash the rest. */
- foreach_list(node, shader->ir) {
- visit_tree((ir_instruction *) node, steal_memory, shader);
- }
+ reparent_ir(shader->ir, shader);
talloc_free(state);
}