iris: Better handle metadata in NIR passes
authorJason Ekstrand <jason@jlekstrand.net>
Fri, 22 May 2020 03:24:28 +0000 (22:24 -0500)
committerMarge Bot <eric+marge@anholt.net>
Thu, 11 Jun 2020 05:08:12 +0000 (05:08 +0000)
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5171>

src/gallium/drivers/iris/iris_program.c

index 98c1c3e93e7a2c9ae60772b66ec342b6af66c044..4790ef34576e13eb2e3b6e837b7607cf96b6edb2 100644 (file)
@@ -267,8 +267,10 @@ iris_lower_storage_image_derefs(nir_shader *nir)
 static bool
 iris_fix_edge_flags(nir_shader *nir)
 {
-   if (nir->info.stage != MESA_SHADER_VERTEX)
+   if (nir->info.stage != MESA_SHADER_VERTEX) {
+      nir_shader_preserve_all_metadata(nir);
       return false;
+   }
 
    nir_variable *var = NULL;
    nir_foreach_variable(v, &nir->outputs) {
@@ -278,8 +280,10 @@ iris_fix_edge_flags(nir_shader *nir)
       }
    }
 
-   if (!var)
+   if (!var) {
+      nir_shader_preserve_all_metadata(nir);
       return false;
+   }
 
    exec_node_remove(&var->node);
    var->data.mode = nir_var_shader_temp;
@@ -294,6 +298,8 @@ iris_fix_edge_flags(nir_shader *nir)
                                         nir_metadata_dominance |
                                         nir_metadata_live_ssa_defs |
                                         nir_metadata_loop_analysis);
+      } else {
+         nir_metadata_preserve(f->impl, nir_metadata_all);
       }
    }