Mesa (master): glsl: add std140 layout support for AoA

Timothy Arceri tarceri at kemper.freedesktop.org
Thu Oct 15 09:44:42 UTC 2015


Module: Mesa
Branch: master
Commit: 261a434996079b29a476a3c67e1e580cf3db76ba
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=261a434996079b29a476a3c67e1e580cf3db76ba

Author: Timothy Arceri <t_arceri at yahoo.com.au>
Date:   Fri Sep 18 22:51:40 2015 +1000

glsl: add std140 layout support for AoA

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias at igalia.com>
Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

---

 src/glsl/glsl_types.cpp |   15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/glsl/glsl_types.cpp b/src/glsl/glsl_types.cpp
index 575ff0e..2793447 100644
--- a/src/glsl/glsl_types.cpp
+++ b/src/glsl/glsl_types.cpp
@@ -1330,8 +1330,8 @@ glsl_type::std140_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;
@@ -1364,12 +1364,13 @@ glsl_type::std140_size(bool row_major) const
     *      the array are laid out in order, according to rule (9).
     */
    if (this->is_array()) {
-      if (this->fields.array->is_record()) {
-         return this->length * this->fields.array->std140_size(row_major);
+      if (this->without_array()->is_record()) {
+	 return this->arrays_of_arrays_size() *
+            this->without_array()->std140_size(row_major);
       } else {
-         unsigned element_base_align =
-            this->fields.array->std140_base_alignment(row_major);
-         return this->length * MAX2(element_base_align, 16);
+	 unsigned element_base_align =
+	    this->without_array()->std140_base_alignment(row_major);
+	 return this->arrays_of_arrays_size() * MAX2(element_base_align, 16);
       }
    }
 




More information about the mesa-commit mailing list