panfrost/midgard: Make search_var take a nir_shader and mode
authorJason Ekstrand <jason@jlekstrand.net>
Mon, 20 Jul 2020 21:07:11 +0000 (16:07 -0500)
committerMarge Bot <eric+marge@anholt.net>
Wed, 29 Jul 2020 17:38:58 +0000 (17:38 +0000)
Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5966>

src/panfrost/midgard/midgard_compile.c

index 4ca807ab40f33ad2a9e5616668c13af0ebd010e3..0a249d57f3d46007cd8f8ea550f176d54b56fab7 100644 (file)
@@ -257,9 +257,9 @@ midgard_nir_lower_fdot2(nir_shader *shader)
 }
 
 static const nir_variable *
-search_var(struct exec_list *vars, unsigned driver_loc)
+search_var(nir_shader *nir, nir_variable_mode mode, unsigned driver_loc)
 {
-        nir_foreach_variable(var, vars) {
+        nir_foreach_variable_with_modes(var, nir, mode) {
                 if (var->data.driver_location == driver_loc)
                         return var;
         }
@@ -330,7 +330,7 @@ midgard_nir_lower_zs_store(nir_shader *nir)
                                 if (intr->intrinsic != nir_intrinsic_store_output)
                                         continue;
 
-                                const nir_variable *var = search_var(&nir->outputs, nir_intrinsic_base(intr));
+                                const nir_variable *var = search_var(nir, nir_var_shader_out, nir_intrinsic_base(intr));
                                 assert(var);
 
                                 if (var->data.location != FRAG_RESULT_COLOR &&
@@ -469,7 +469,7 @@ midgard_nir_reorder_writeout(nir_shader *nir)
                                 if (intr->intrinsic != nir_intrinsic_store_output)
                                         continue;
 
-                                const nir_variable *var = search_var(&nir->outputs, nir_intrinsic_base(intr));
+                                const nir_variable *var = search_var(nir, nir_var_shader_out, nir_intrinsic_base(intr));
 
                                 if (var->data.index) {
                                         if (!last_writeout)
@@ -1690,7 +1690,7 @@ output_load_rt_addr(compiler_context *ctx, nir_intrinsic_instr *instr)
                 return ctx->blend_rt;
 
         const nir_variable *var;
-        var = search_var(&ctx->nir->outputs, nir_intrinsic_base(instr));
+        var = search_var(ctx->nir, nir_var_shader_out, nir_intrinsic_base(instr));
         assert(var);
 
         unsigned loc = var->data.location;
@@ -1899,7 +1899,7 @@ emit_intrinsic(compiler_context *ctx, nir_intrinsic_instr *instr)
                                 nir_intrinsic_store_combined_output_pan;
 
                         const nir_variable *var;
-                        var = search_var(&ctx->nir->outputs,
+                        var = search_var(ctx->nir, nir_var_shader_out,
                                          nir_intrinsic_base(instr));
                         assert(var);