This will be used in the following patches to determine if we
support packing the components of a varying.
---
 src/compiler/nir/nir_linking_helpers.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/src/compiler/nir/nir_linking_helpers.c 
b/src/compiler/nir/nir_linking_helpers.c
index 845aba5c87..c26582ddec 100644
--- a/src/compiler/nir/nir_linking_helpers.c
+++ b/src/compiler/nir/nir_linking_helpers.c
@@ -224,6 +224,29 @@ get_interp_loc(nir_variable *var)
       return INTERPOLATE_LOC_CENTER;
 }
 
+static bool
+is_packing_supported_for_type(const struct glsl_type *type)
+{
+   /* Skip types that require more complex packing handling.
+    * TODO: add support for these types?
+    */
+   if (glsl_type_is_array(type) ||
+       glsl_type_is_dual_slot(type) ||
+       glsl_type_is_matrix(type) ||
+       glsl_type_is_struct(type) ||
+       glsl_type_is_64bit(type))
+      return false;
+
+   /* We ignore complex types above and all other vector types should
+    * have been split into scalar variables by the lower_io_to_scalar
+    * pass. The only exeption should by OpenGL xfb varyings.
+    */
+   if (glsl_get_vector_elements(type) != 1)
+      return false;
+
+   return true;
+}
+
 static void
 get_slot_component_masks_and_interp_types(struct exec_list *var_list,
                                           uint8_t *comps,
-- 
2.19.2

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

Reply via email to