Browse Source

glsl: create type name for arrays of arrays

We need to insert outermost dimensions in the correct spot otherwise
 the dimension order will be backwards

Signed-off-by: Timothy Arceri <t_arceri@yahoo.com.au>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
tags/mesa-10.1-rc1
Timothy Arceri 11 years ago
parent
commit
61a5846099
1 changed files with 14 additions and 2 deletions
  1. 14
    2
      src/glsl/glsl_types.cpp

+ 14
- 2
src/glsl/glsl_types.cpp View File

@@ -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;
}

Loading…
Cancel
Save