iris: Wrap iris_fix_edge_flags in NIR_PASS
authorKenneth Graunke <kenneth@whitecape.org>
Thu, 14 Nov 2019 18:22:17 +0000 (10:22 -0800)
committerKenneth Graunke <kenneth@whitecape.org>
Thu, 14 Nov 2019 22:50:11 +0000 (14:50 -0800)
So nir_validate happens properly.  Unfortunately this means we have
to play the metadata song and dance, so walk over all impls and say
that we didn't hurt anything.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
src/gallium/drivers/iris/iris_program.c

index 04f28a7..f2269a4 100644 (file)
@@ -212,6 +212,15 @@ iris_fix_edge_flags(nir_shader *nir)
    nir->info.inputs_read &= ~VERT_BIT_EDGEFLAG;
    nir_fixup_deref_modes(nir);
 
+   nir_foreach_function(f, nir) {
+      if (f->impl) {
+         nir_metadata_preserve(f->impl, nir_metadata_block_index |
+                                        nir_metadata_dominance |
+                                        nir_metadata_live_ssa_defs |
+                                        nir_metadata_loop_analysis);
+      }
+   }
+
    return true;
 }
 
@@ -2017,7 +2026,7 @@ iris_create_uncompiled_shader(struct pipe_context *ctx,
    if (!ish)
       return NULL;
 
-   ish->needs_edge_flag = iris_fix_edge_flags(nir);
+   NIR_PASS(ish->needs_edge_flag, nir, iris_fix_edge_flags);
 
    brw_preprocess_nir(screen->compiler, nir, NULL);