Reviewed-by: Timothy Arceri <tarc...@itsqueeze.com>

On 5/4/19 8:26 pm, Samuel Pitoiset wrote:
The current algorithm only supports packing 32-bit types.
If a shader uses both 16-bit and 32-bit varyings, we shouldn't
compact them together.

v2 - fix regressions spotted by Intel CI

Cc: Timothy Arceri <tarc...@itsqueeze.com>
Signed-off-by: Samuel Pitoiset <samuel.pitoi...@gmail.com>
---
  src/compiler/nir/nir_linking_helpers.c | 13 +++++++++++++
  1 file changed, 13 insertions(+)

diff --git a/src/compiler/nir/nir_linking_helpers.c 
b/src/compiler/nir/nir_linking_helpers.c
index 146d4e4e591..7594728e25e 100644
--- a/src/compiler/nir/nir_linking_helpers.c
+++ b/src/compiler/nir/nir_linking_helpers.c
@@ -243,6 +243,7 @@ struct assigned_comps
     uint8_t comps;
     uint8_t interp_type;
     uint8_t interp_loc;
+   bool is_32bit;
  };
/* Packing arrays and dual slot varyings is difficult so to avoid complex
@@ -308,6 +309,7 @@ get_unmoveable_components_masks(struct exec_list *var_list,
              comps[location + i].interp_type =
                 get_interp_type(var, type, default_to_smooth_interp);
              comps[location + i].interp_loc = get_interp_loc(var);
+            comps[location + i].is_32bit = glsl_type_is_32bit(type);
           }
        }
     }
@@ -423,6 +425,7 @@ struct varying_component {
     nir_variable *var;
     uint8_t interp_type;
     uint8_t interp_loc;
+   bool is_32bit;
     bool is_patch;
     bool initialised;
  };
@@ -539,6 +542,7 @@ gather_varying_component_info(nir_shader *consumer,
              vc_info->interp_type =
                 get_interp_type(in_var, type, default_to_smooth_interp);
              vc_info->interp_loc = get_interp_loc(in_var);
+            vc_info->is_32bit = glsl_type_is_32bit(type);
              vc_info->is_patch = in_var->data.patch;
           }
        }
@@ -572,6 +576,14 @@ assign_remap_locations(struct varying_loc (*remap)[4],
              continue;
           }
+ /* We can only pack varyings with matching types, and the current
+          * algorithm only supports packing 32-bit.
+          */
+         if (!assigned_comps[tmp_cursor].is_32bit) {
+            tmp_comp = 0;
+            continue;
+         }
+
           while (tmp_comp < 4 &&
                  (assigned_comps[tmp_cursor].comps & (1 << tmp_comp))) {
              tmp_comp++;
@@ -589,6 +601,7 @@ assign_remap_locations(struct varying_loc (*remap)[4],
        assigned_comps[tmp_cursor].comps |= (1 << tmp_comp);
        assigned_comps[tmp_cursor].interp_type = info->interp_type;
        assigned_comps[tmp_cursor].interp_loc = info->interp_loc;
+      assigned_comps[tmp_cursor].is_32bit = info->is_32bit;
/* Assign remap location */
        remap[location][info->var->data.location_frac].component = tmp_comp++;

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to