if (this->interface_packing != b->interface_packing)
return false;
+ /* From the GLSL 4.20 specification (Sec 4.2):
+ *
+ * "Structures must have the same name, sequence of type names, and
+ * type definitions, and field names to be considered the same type."
+ *
+ * GLSL ES behaves the same (Ver 1.00 Sec 4.2.4, Ver 3.00 Sec 4.2.5).
+ *
+ * Note that we cannot force type name check when comparing unnamed
+ * structure types, these have a unique name assigned during parsing.
+ */
+ if (!this->is_anonymous() && !b->is_anonymous())
+ if (strcmp(this->name, b->name) != 0)
+ return false;
+
for (unsigned i = 0; i < this->length; i++) {
if (this->fields.structure[i].type != b->fields.structure[i].type)
return false;
return base_type == GLSL_TYPE_ERROR;
}
+ /**
+ * Query if a type is unnamed/anonymous (named by the parser)
+ */
+ bool is_anonymous() const
+ {
+ return !strncmp(name, "#anon", 5);
+ }
+
/**
* Get the type stripped of any arrays
*