/* We need this for phi sources */
add_remap(state, nblk, blk);
- nir_foreach_instr(blk, instr) {
+ nir_foreach_instr(instr, blk) {
if (instr->type == nir_instr_type_phi) {
/* Phi instructions are a bit of a special case when cloning because
* we don't want inserting the instruction to automatically handle
clone_state state;
init_clone_state(&state, true);
- nir_shader *ns = nir_shader_create(mem_ctx, s->stage, s->options);
+ nir_shader *ns = nir_shader_create(mem_ctx, s->stage, s->options, NULL);
state.ns = ns;
clone_var_list(&state, &ns->uniforms, &s->uniforms);
* functions of other functions and we don't know what order the functions
* will have in the list.
*/
- nir_foreach_function(s, fxn) {
+ nir_foreach_function(fxn, s) {
nir_function *nfxn = remap_global(&state, fxn);
nfxn->impl = clone_function_impl(&state, fxn->impl);
nfxn->impl->function = nfxn;
clone_reg_list(&state, &ns->registers, &s->registers);
ns->reg_alloc = s->reg_alloc;
- ns->info = s->info;
- ns->info.name = ralloc_strdup(ns, ns->info.name);
- if (ns->info.label)
- ns->info.label = ralloc_strdup(ns, ns->info.label);
+ *ns->info = *s->info;
+ ns->info->name = ralloc_strdup(ns, ns->info->name);
+ if (ns->info->label)
+ ns->info->label = ralloc_strdup(ns, ns->info->label);
ns->num_inputs = s->num_inputs;
ns->num_uniforms = s->num_uniforms;