freedreno/ir3_cmdline: Rework i/o variable fixup
authorJason Ekstrand <jason@jlekstrand.net>
Mon, 20 Jul 2020 20:53:59 +0000 (15:53 -0500)
committerMarge Bot <eric+marge@anholt.net>
Wed, 29 Jul 2020 17:38:58 +0000 (17:38 +0000)
Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5966>

src/gallium/drivers/freedreno/ir3/ir3_cmdline.c

index 294fb61e7526438e15671bc7113ac44c8aa2ae1b..dafc39911f26313500223294898db1ed6cced60a 100644 (file)
@@ -77,11 +77,11 @@ insert_sorted(struct exec_list *var_list, nir_variable *new_var)
 }
 
 static void
-sort_varyings(struct exec_list *var_list)
+sort_varyings(nir_shader *nir, nir_variable_mode mode)
 {
        struct exec_list new_list;
        exec_list_make_empty(&new_list);
-       nir_foreach_variable_safe(var, var_list) {
+       nir_foreach_variable_with_modes_safe(var, nir, mode) {
                exec_node_remove(&var->node);
                insert_sorted(&new_list, var);
        }
@@ -89,9 +89,9 @@ sort_varyings(struct exec_list *var_list)
 }
 
 static void
-fixup_varying_slots(struct exec_list *var_list)
+fixup_varying_slots(nir_shader *nir, nir_variable_mode mode)
 {
-       nir_foreach_variable(var, var_list) {
+       nir_foreach_variable_with_modes(var, nir, mode) {
                if (var->data.location >= VARYING_SLOT_VAR0) {
                        var->data.location += 9;
                } else if ((var->data.location >= VARYING_SLOT_TEX0) &&
@@ -154,18 +154,18 @@ load_glsl(unsigned num_files, char* const* files, gl_shader_stage stage)
                /* Re-lower global vars, to deal with any dead VS inputs. */
                NIR_PASS_V(nir, nir_lower_global_vars_to_local);
 
-               sort_varyings(&nir->outputs);
+               sort_varyings(nir, nir_var_shader_out);
                nir_assign_var_locations(nir, nir_var_shader_out,
                                &nir->num_outputs,
                                ir3_glsl_type_size);
-               fixup_varying_slots(&nir->outputs);
+               fixup_varying_slots(nir, nir_var_shader_out);
                break;
        case MESA_SHADER_FRAGMENT:
-               sort_varyings(&nir->inputs);
+               sort_varyings(nir, nir_var_shader_in);
                nir_assign_var_locations(nir, nir_var_shader_in,
                                &nir->num_inputs,
                                ir3_glsl_type_size);
-               fixup_varying_slots(&nir->inputs);
+               fixup_varying_slots(nir, nir_var_shader_in);
                nir_assign_var_locations(nir, nir_var_shader_out,
                                &nir->num_outputs,
                                ir3_glsl_type_size);