glsl2: Don't claim a match on structure types with different field names.
authorEric Anholt <eric@anholt.net>
Tue, 20 Jul 2010 23:38:23 +0000 (16:38 -0700)
committerEric Anholt <eric@anholt.net>
Wed, 21 Jul 2010 00:30:10 +0000 (17:30 -0700)
We regularly do lookups on the field names of the structure to find
the types within the struct, so returning a structure type with bad
names will lead to lots of error types being found.

src/glsl/glsl_types.cpp

index d6799cf4283de680e8fe6b626caa7ed7b70cd96d..6ca141ef481de2d5eae8cb1fe4281155137e1c1c 100644 (file)
@@ -438,10 +438,13 @@ glsl_type::record_key_compare(const void *a, const void *b)
    if (key1->length != key2->length)
       return 1;
 
-   for (unsigned i = 0; i < key1->length; i++)
-      /* FINISHME: Is the name of the structure field also significant? */
+   for (unsigned i = 0; i < key1->length; i++) {
       if (key1->fields.structure[i].type != key2->fields.structure[i].type)
         return 1;
+      if (strcmp(key1->fields.structure[i].name,
+                key2->fields.structure[i].name) != 0)
+        return 1;
+   }
 
    return 0;
 }