Mesa (master): nir: Record non-vector/scalar varyings as unmovable when compacting

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Mar 21 16:04:15 UTC 2019


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

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Tue Mar 19 21:40:51 2019 -0700

nir: Record non-vector/scalar varyings as unmovable when compacting

In some cases, we can end up with varying structs that aren't split to
their member variables.  nir_compact_varyings attempted to record these
as unmovable, so it would leave them be.  Unfortunately, it didn't do
it right for non-vector/scalar types.  It set the mask to:

   ((1 << (elements * dmul)) - 1) << var->data.location_frac

where elements is the number of vector elements.  For structures and
other non-vector/scalars, elements is 0...so the whole mask became 0.

This caused nir_compact_varyings to assign other varyings on top of
the structure varying's location (as it appeared to take up no space).

To combat this, we just set elements to 4 for non-vector/scalar types,
so that the entire slot gets marked as unmovable.

Fixes KHR-GL45.tessellation_shader.tessellation_control_to_tessellation_evaluation.gl_in on iris.

Reviewed-by: Timothy Arceri <tarceri at itsqueeze.com>

---

 src/compiler/nir/nir_linking_helpers.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/compiler/nir/nir_linking_helpers.c b/src/compiler/nir/nir_linking_helpers.c
index 02b5ae4b066..146d4e4e591 100644
--- a/src/compiler/nir/nir_linking_helpers.c
+++ b/src/compiler/nir/nir_linking_helpers.c
@@ -275,8 +275,10 @@ get_unmoveable_components_masks(struct exec_list *var_list,
             continue;
 
          unsigned location = var->data.location - VARYING_SLOT_VAR0;
+
          unsigned elements =
-            glsl_get_vector_elements(glsl_without_array(type));
+            glsl_type_is_vector_or_scalar(glsl_without_array(type)) ?
+            glsl_get_vector_elements(glsl_without_array(type)) : 4;
 
          bool dual_slot = glsl_type_is_dual_slot(glsl_without_array(type));
          unsigned slots = glsl_count_attribute_slots(type, false);




More information about the mesa-commit mailing list