summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSamuel Iglesias Gonsalvez <[email protected]>2015-09-21 09:09:11 +0200
committerSamuel Iglesias Gonsalvez <[email protected]>2015-09-25 08:39:21 +0200
commit1440d2a6833902d9c966fe8ad7db46a7f787391c (patch)
tree4eff3b75c5c358a2501cc1c04e90c481206b6dfe /src
parent68f5a4e6d2c5bec39b425a41eac6b190a8a7d14a (diff)
glsl: Add unsized array support to glsl_type::std140_size()
Reviewed-by: Kristian Høgsberg <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/glsl/glsl_types.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/glsl/glsl_types.cpp b/src/glsl/glsl_types.cpp
index b4525eb9cf2..07d72489057 100644
--- a/src/glsl/glsl_types.cpp
+++ b/src/glsl/glsl_types.cpp
@@ -1351,7 +1351,7 @@ glsl_type::std140_size(bool row_major) const
* rounded up to the next multiple of the base alignment of the
* structure.
*/
- if (this->is_record()) {
+ if (this->is_record() || this->is_interface()) {
unsigned size = 0;
unsigned max_align = 0;
@@ -1367,6 +1367,11 @@ glsl_type::std140_size(bool row_major) const
const struct glsl_type *field_type = this->fields.structure[i].type;
unsigned align = field_type->std140_base_alignment(field_row_major);
+
+ /* Ignore unsized arrays when calculating size */
+ if (field_type->is_unsized_array())
+ continue;
+
size = glsl_align(size, align);
size += field_type->std140_size(field_row_major);