glsl: add std430 layout support for AoA
authorSamuel Iglesias Gonsalvez <siglesias@igalia.com>
Tue, 22 Sep 2015 14:25:46 +0000 (16:25 +0200)
committerSamuel Iglesias Gonsalvez <siglesias@igalia.com>
Tue, 6 Oct 2015 12:02:13 +0000 (14:02 +0200)
Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Reviewed-by: Timothy Arceri <t_arceri@yahoo.com.au>
src/glsl/glsl_types.cpp

index 25927f67c44346d490916b6468bcff9cb0f018bf..b9cb97cbeae9e025fba316db9e6890161767c491 100644 (file)
@@ -1557,8 +1557,8 @@ glsl_type::std430_size(bool row_major) const
       unsigned int array_len;
 
       if (this->is_array()) {
-         element_type = this->fields.array;
-         array_len = this->length;
+         element_type = this->without_array();
+         array_len = this->arrays_of_arrays_size();
       } else {
          element_type = this;
          array_len = 1;
@@ -1581,10 +1581,12 @@ glsl_type::std430_size(bool row_major) const
    }
 
    if (this->is_array()) {
-      if (this->fields.array->is_record())
-         return this->length * this->fields.array->std430_size(row_major);
+      if (this->without_array()->is_record())
+         return this->arrays_of_arrays_size() *
+            this->without_array()->std430_size(row_major);
       else
-         return this->length * this->fields.array->std430_base_alignment(row_major);
+         return this->arrays_of_arrays_size() *
+            this->without_array()->std430_base_alignment(row_major);
    }
 
    if (this->is_record() || this->is_interface()) {