lima/standalone: Rework i/o variable fixup
authorJason Ekstrand <jason@jlekstrand.net>
Mon, 20 Jul 2020 20:48:22 +0000 (15:48 -0500)
committerMarge Bot <eric+marge@anholt.net>
Wed, 29 Jul 2020 17:38:58 +0000 (17:38 +0000)
Reviewed-by: Vasily Khoruzhick <anarsoul@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5966>

src/gallium/drivers/lima/standalone/lima_compiler_cmdline.c

index 044bbcccf7db8d5d294f4ec71786cc4869405e99..a9d1fba440b716c3df223050cf2cb87bb5719c09 100644 (file)
@@ -59,11 +59,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);
    }
@@ -71,9 +71,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) &&
@@ -146,16 +146,16 @@ 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,
                                st_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,
                                st_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,
                                st_glsl_type_size);
       break;