glsl: Account for location field when comparing interface blocks.
authorPaul Berry <stereotype441@gmail.com>
Sat, 28 Sep 2013 18:00:26 +0000 (11:00 -0700)
committerPaul Berry <stereotype441@gmail.com>
Thu, 10 Oct 2013 21:27:03 +0000 (14:27 -0700)
In commit e2660770731b018411fbe1620cacddaf8dff5287 (glsl: Keep track
of location for interface block fields), I neglected to update
glsl_type::record_key_compare to account for the fact that interface
types now contain location information.  As a result, interface types
that differ only by their location information would not be properly
distinguished.

At the moment this is not a problem, because the only interface block
in which location information != -1 is gl_PerVertex, and gl_PerVertex
is always created in the same way.  However, in the patches that
follow, we'll be adding new ways to create gl_PerVertex (by
redeclaring it), so we'll need location information to be handled
properly.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
src/glsl/glsl_types.cpp

index c4c04fe32ecf580dbcd2e3c0a32b5a9ea58bd8eb..80a6e71a721d4fdf60d5a50eb68bafcd1daf68c4 100644 (file)
@@ -452,6 +452,9 @@ glsl_type::record_key_compare(const void *a, const void *b)
       if (key1->fields.structure[i].row_major
          != key2->fields.structure[i].row_major)
         return 1;
+      if (key1->fields.structure[i].location
+          != key2->fields.structure[i].location)
+         return 1;
    }
 
    return 0;