aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/glsl/glsl_types.cpp
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2014-01-26 20:19:23 +0100
committermarha <marha@users.sourceforge.net>2014-01-26 20:19:23 +0100
commit5f455179ae4b279a82d99a7a3dabe61f58c42ad6 (patch)
treefdecec022cf1b8b782b90a64c14e374fa6d400cb /mesalib/src/glsl/glsl_types.cpp
parent78d84bd03c744b0ed420c450dd2807904ccaef21 (diff)
parent30af30b78075159fce477ae99cc72540133714d0 (diff)
downloadvcxsrv-5f455179ae4b279a82d99a7a3dabe61f58c42ad6.tar.gz
vcxsrv-5f455179ae4b279a82d99a7a3dabe61f58c42ad6.tar.bz2
vcxsrv-5f455179ae4b279a82d99a7a3dabe61f58c42ad6.zip
Merge remote-tracking branch 'origin/released'
* origin/released: xserver randrproto libxtrans fontconfig libxcb xcb-proto mesa git update 26 Jan 2014 Conflicts: X11/xtrans/Xtrans.c xorg-server/dix/dispatch.c xorg-server/os/xdmcp.c
Diffstat (limited to 'mesalib/src/glsl/glsl_types.cpp')
-rw-r--r--mesalib/src/glsl/glsl_types.cpp83
1 files changed, 51 insertions, 32 deletions
diff --git a/mesalib/src/glsl/glsl_types.cpp b/mesalib/src/glsl/glsl_types.cpp
index 12d4ac0ee..1b0b3ef88 100644
--- a/mesalib/src/glsl/glsl_types.cpp
+++ b/mesalib/src/glsl/glsl_types.cpp
@@ -300,8 +300,20 @@ glsl_type::glsl_type(const glsl_type *array, unsigned length) :
if (length == 0)
snprintf(n, name_length, "%s[]", array->name);
- else
- snprintf(n, name_length, "%s[%u]", array->name, length);
+ else {
+ /* insert outermost dimensions in the correct spot
+ * otherwise the dimension order will be backwards
+ */
+ const char *pos = strchr(array->name, '[');
+ if (pos) {
+ int idx = pos - array->name;
+ snprintf(n, idx+1, "%s", array->name);
+ snprintf(n + idx, name_length - idx, "[%u]%s",
+ length, array->name + idx);
+ } else {
+ snprintf(n, name_length, "%s[%u]", array->name, length);
+ }
+ }
this->name = n;
}
@@ -449,6 +461,42 @@ glsl_type::get_array_instance(const glsl_type *base, unsigned array_size)
}
+bool
+glsl_type::record_compare(const glsl_type *b) const
+{
+ if (this->length != b->length)
+ return false;
+
+ if (this->interface_packing != b->interface_packing)
+ return false;
+
+ for (unsigned i = 0; i < this->length; i++) {
+ if (this->fields.structure[i].type != b->fields.structure[i].type)
+ return false;
+ if (strcmp(this->fields.structure[i].name,
+ b->fields.structure[i].name) != 0)
+ return false;
+ if (this->fields.structure[i].row_major
+ != b->fields.structure[i].row_major)
+ return false;
+ if (this->fields.structure[i].location
+ != b->fields.structure[i].location)
+ return false;
+ if (this->fields.structure[i].interpolation
+ != b->fields.structure[i].interpolation)
+ return false;
+ if (this->fields.structure[i].centroid
+ != b->fields.structure[i].centroid)
+ return false;
+ if (this->fields.structure[i].sample
+ != b->fields.structure[i].sample)
+ return false;
+ }
+
+ return true;
+}
+
+
int
glsl_type::record_key_compare(const void *a, const void *b)
{
@@ -461,36 +509,7 @@ glsl_type::record_key_compare(const void *a, const void *b)
if (strcmp(key1->name, key2->name) != 0)
return 1;
- if (key1->length != key2->length)
- return 1;
-
- if (key1->interface_packing != key2->interface_packing)
- return 1;
-
- 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;
- 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;
- if (key1->fields.structure[i].interpolation
- != key2->fields.structure[i].interpolation)
- return 1;
- if (key1->fields.structure[i].centroid
- != key2->fields.structure[i].centroid)
- return 1;
- if (key1->fields.structure[i].sample
- != key2->fields.structure[i].sample)
- return 1;
- }
-
- return 0;
+ return !key1->record_compare(key2);
}