Mesa (master): glsl: mark xfb inputs as always_active_io

Timothy Arceri tarceri at kemper.freedesktop.org
Sun Oct 15 22:07:12 UTC 2017


Module: Mesa
Branch: master
Commit: 9f7127f5d29715a4b95e70e805a2b0f1f5714a64
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=9f7127f5d29715a4b95e70e805a2b0f1f5714a64

Author: Timothy Arceri <tarceri at itsqueeze.com>
Date:   Fri Sep 22 16:04:17 2017 +1000

glsl: mark xfb inputs as always_active_io

We won't split varyings marked as always active because there
is no point in doing so. This means we need to mark both
sides of the interface as always active otherwise we will have
a mismatch and start removing things we shouldn't.

Reviewed-by: Eric Anholt <eric at anholt.net>

---

 src/compiler/glsl/link_varyings.cpp | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)

diff --git a/src/compiler/glsl/link_varyings.cpp b/src/compiler/glsl/link_varyings.cpp
index ed3bf41687..29842ecacd 100644
--- a/src/compiler/glsl/link_varyings.cpp
+++ b/src/compiler/glsl/link_varyings.cpp
@@ -2268,9 +2268,6 @@ assign_varying_locations(struct gl_context *ctx,
       }
    }
 
-   _mesa_hash_table_destroy(consumer_inputs, NULL);
-   _mesa_hash_table_destroy(consumer_interface_inputs, NULL);
-
    for (unsigned i = 0; i < num_tfeedback_decls; ++i) {
       if (!tfeedback_decls[i].is_varying())
          continue;
@@ -2286,12 +2283,31 @@ assign_varying_locations(struct gl_context *ctx,
       /* Mark xfb varyings as always active */
       matched_candidate->toplevel_var->data.always_active_io = 1;
 
+      /* Mark any corresponding inputs as always active also. We must do this
+       * because we have a NIR pass that lowers vectors to scalars and another
+       * that removes unused varyings.
+       * We don't split varyings marked as always active because there is no
+       * point in doing so. This means we need to mark both sides of the
+       * interface as always active otherwise we will have a mismatch and
+       * start removing things we shouldn't.
+       */
+      ir_variable *const input_var =
+         linker::get_matching_input(mem_ctx, matched_candidate->toplevel_var,
+                                    consumer_inputs,
+                                    consumer_interface_inputs,
+                                    consumer_inputs_with_locations);
+      if (input_var)
+         input_var->data.always_active_io = 1;
+
       if (matched_candidate->toplevel_var->data.is_unmatched_generic_inout) {
          matched_candidate->toplevel_var->data.is_xfb_only = 1;
          matches.record(matched_candidate->toplevel_var, NULL);
       }
    }
 
+   _mesa_hash_table_destroy(consumer_inputs, NULL);
+   _mesa_hash_table_destroy(consumer_interface_inputs, NULL);
+
    uint8_t components[MAX_VARYINGS_INCL_PATCH] = {0};
    const unsigned slots_used = matches.assign_locations(
          prog, components, reserved_slots);




More information about the mesa-commit mailing list