glsl: Make sure row-major array-of-structure get correct layout
authorIan Romanick <ian.d.romanick@intel.com>
Tue, 9 Sep 2014 01:25:15 +0000 (18:25 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Fri, 26 Sep 2014 14:59:47 +0000 (07:59 -0700)
Whether or not the field is row-major (because it might be a bvec2 or
something) does not affect the array itself.  We need to know whether an
array element in its entirety is row-major.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=83506
Cc: mesa-stable@lists.freedesktop.org
src/glsl/lower_ubo_reference.cpp

index 4ae1aac7765350fd9302adaabb70c14f92e79091..f3920b362ce3ce5e16609df6904843d57632ead6 100644 (file)
@@ -301,7 +301,14 @@ lower_ubo_reference_visitor::handle_rvalue(ir_rvalue **rvalue)
             deref = deref_array->array->as_dereference();
             break;
         } else {
-           array_stride = deref_array->type->std140_size(row_major);
+            /* Whether or not the field is row-major (because it might be a
+             * bvec2 or something) does not affect the array itself.  We need
+             * to know whether an array element in its entirety is row-major.
+             */
+            const bool array_row_major =
+               is_dereferenced_thing_row_major(deref_array);
+
+           array_stride = deref_array->type->std140_size(array_row_major);
            array_stride = glsl_align(array_stride, 16);
         }