class lower_subroutine_visitor : public ir_hierarchical_visitor {
public:
- lower_subroutine_visitor()
+ lower_subroutine_visitor(struct _mesa_glsl_parse_state *state)
+ : state(state)
{
this->progress = false;
}
bool
lower_subroutine(exec_list *instructions, struct _mesa_glsl_parse_state *state)
{
- lower_subroutine_visitor v;
- v.state = state;
+ lower_subroutine_visitor v(state);
visit_list_elements(&v, instructions);
return v.progress;
}
continue;
if (ir->array_idx != NULL)
- var = new(mem_ctx) ir_dereference_array(ir->sub_var, ir->array_idx->clone(mem_ctx, NULL));
+ var = ir->array_idx->clone(mem_ctx, NULL);
else
var = new(mem_ctx) ir_dereference_variable(ir->sub_var);
else
last_branch = if_tree(equal(subr_to_int(var), lc), new_call, last_branch);
- if (s > 0)
+ if (return_deref && s > 0)
return_deref = return_deref->clone(mem_ctx, NULL);
}
if (last_branch)