[Mesa-dev] [PATCH 22/27] glsl: add helper for comparing arrays in varying packing pass
Timothy Arceri
timothy.arceri at collabora.com
Thu Mar 31 10:57:57 UTC 2016
---
src/compiler/glsl/lower_packed_varyings.cpp | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/src/compiler/glsl/lower_packed_varyings.cpp b/src/compiler/glsl/lower_packed_varyings.cpp
index ad766bb..6e7a289 100644
--- a/src/compiler/glsl/lower_packed_varyings.cpp
+++ b/src/compiler/glsl/lower_packed_varyings.cpp
@@ -152,6 +152,31 @@
using namespace ir_builder;
+/**
+ * If the var is an array check if it matches the array attributes of the
+ * packed var.
+ */
+static bool
+check_for_matching_arrays(ir_variable *packed_var, ir_variable *var)
+{
+ const glsl_type *pt = packed_var->type;
+ const glsl_type *vt = var->type;
+ bool array_match = true;
+
+ while (pt->is_array() || vt->is_array()) {
+ if (pt->is_array() != vt->is_array() ||
+ pt->length != vt->length) {
+ array_match = false;
+ break;
+ } else {
+ pt = pt->fields.array;
+ vt = vt->fields.array;
+ }
+ }
+
+ return array_match;
+}
+
static bool
needs_lowering(ir_variable *var, bool has_enhanced_layouts,
bool disable_varying_packing)
--
2.5.5
More information about the mesa-dev
mailing list