zink: refcount zink_gfx_program objects
[mesa.git] / src / gallium / drivers / iris / iris_program.c
index 4790ef34576e13eb2e3b6e837b7607cf96b6edb2..a9e464bcb465005879e9e46f7b421ab4016deb49 100644 (file)
@@ -125,6 +125,7 @@ iris_to_brw_fs_key(const struct gen_device_info *devinfo,
       .coherent_fb_fetch = key->coherent_fb_fetch,
       .color_outputs_valid = key->color_outputs_valid,
       .input_slots_valid = key->input_slots_valid,
+      .ignore_sample_mask_out = !key->multisample_fbo,
    };
 }
 
@@ -272,22 +273,14 @@ iris_fix_edge_flags(nir_shader *nir)
       return false;
    }
 
-   nir_variable *var = NULL;
-   nir_foreach_variable(v, &nir->outputs) {
-      if (v->data.location == VARYING_SLOT_EDGE) {
-         var = v;
-         break;
-      }
-   }
-
+   nir_variable *var = nir_find_variable_with_location(nir, nir_var_shader_out,
+                                                       VARYING_SLOT_EDGE);
    if (!var) {
       nir_shader_preserve_all_metadata(nir);
       return false;
    }
 
-   exec_node_remove(&var->node);
    var->data.mode = nir_var_shader_temp;
-   exec_list_push_tail(&nir->globals, &var->node);
    nir->info.outputs_written &= ~VARYING_BIT_EDGE;
    nir->info.inputs_read &= ~VERT_BIT_EDGEFLAG;
    nir_fixup_deref_modes(nir);
@@ -1842,9 +1835,6 @@ get_vue_prog_data(struct iris_context *ice, gl_shader_stage stage)
    return (void *) ice->shaders.prog[stage]->prog_data;
 }
 
-// XXX: iris_compiled_shaders are space-leaking :(
-// XXX: do remember to unbind them if deleting them.
-
 /**
  * Update the current shader variants for the given state.
  *
@@ -2426,6 +2416,8 @@ iris_delete_shader_state(struct pipe_context *ctx, void *state, gl_shader_stage
       pipe_resource_reference(&ish->const_data_state.res, NULL);
    }
 
+   iris_delete_shader_variants(ice, ish);
+
    ralloc_free(ish->nir);
    free(ish);
 }