Mesa (glsl2): glsl2: Don' t claim a match on structure types with different field names.

Eric Anholt anholt at kemper.freedesktop.org
Wed Jul 21 00:30:27 UTC 2010


Module: Mesa
Branch: glsl2
Commit: b6e92ad7da9d4f00607caca90bd0b8853623a493
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=b6e92ad7da9d4f00607caca90bd0b8853623a493

Author: Eric Anholt <eric at anholt.net>
Date:   Tue Jul 20 16:38:23 2010 -0700

glsl2: Don't claim a match on structure types with different field names.

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 |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/glsl/glsl_types.cpp b/src/glsl/glsl_types.cpp
index d6799cf..6ca141e 100644
--- a/src/glsl/glsl_types.cpp
+++ b/src/glsl/glsl_types.cpp
@@ -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;
 }




More information about the mesa-commit mailing list