return 0;
}
+unsigned
+glsl_type::uniform_locations() const
+{
+ if (this->is_matrix())
+ return 1;
+
+ unsigned size = 0;
+
+ switch (this->base_type) {
+ case GLSL_TYPE_STRUCT:
+ case GLSL_TYPE_INTERFACE:
+ for (unsigned i = 0; i < this->length; i++)
+ size += this->fields.structure[i].type->uniform_locations();
+ return size;
+ case GLSL_TYPE_ARRAY:
+ return this->length * this->fields.array->uniform_locations();
+ default:
+ break;
+ }
+
+ /* The location count for many types match with component_slots() result,
+ * all expections should be handled above.
+ */
+ return component_slots();
+}
+
bool
glsl_type::can_implicitly_convert_to(const glsl_type *desired,
_mesa_glsl_parse_state *state) const
*/
unsigned component_slots() const;
+ /**
+ * Calculate the number of unique values from glGetUniformLocation for the
+ * elements of the type.
+ */
+ unsigned uniform_locations() const;
+
/**
* Calculate the number of attribute slots required to hold this type
*