st/mesa/glsl/nir/i965: make use of new gl_shader_program_data in gl_shader_program
[mesa.git] / src / compiler / nir / nir_clone.c
index e231387c889d1f4f19eabe860ea1545864014ebb..4f7bdd969697435f4acb00199872ca1affd4a164 100644 (file)
@@ -523,7 +523,7 @@ clone_block(clone_state *state, struct exec_list *cf_list, const nir_block *blk)
    /* 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
@@ -682,7 +682,7 @@ nir_shader_clone(void *mem_ctx, const nir_shader *s)
    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);
@@ -701,7 +701,7 @@ nir_shader_clone(void *mem_ctx, const nir_shader *s)
     * 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;
@@ -710,10 +710,10 @@ nir_shader_clone(void *mem_ctx, const nir_shader *s)
    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;