From: Ian Romanick Date: Wed, 10 Sep 2014 17:54:55 +0000 (-0700) Subject: glsl: Round struct size up to at least 16 bytes X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2ab71e1486e76722154b48faef8216ff8173fd30;p=mesa.git glsl: Round struct size up to at least 16 bytes Per rule #9, the size of the structure is vec4 aligned. The MAX2 in the loop ensures that sizes >= 16 bytes are vec4 aligned. The new MAX2 after the loop ensures that sizes < 16 bytes are vec4 aligned. Signed-off-by: Ian Romanick Reviewed-by: Jordan Justen Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=82932 Cc: mesa-stable@lists.freedesktop.org --- diff --git a/src/glsl/glsl_types.cpp b/src/glsl/glsl_types.cpp index 435b8667330..c11d86482be 100644 --- a/src/glsl/glsl_types.cpp +++ b/src/glsl/glsl_types.cpp @@ -979,7 +979,7 @@ glsl_type::std140_size(bool row_major) const if (field_type->is_record() && (i + 1 < this->length)) size = glsl_align(size, 16); } - size = glsl_align(size, max_align); + size = glsl_align(size, MAX2(max_align, 16)); return size; }