From 79b7046a272ffd33f221b85cf45a128fc498680f Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Tue, 12 Jan 2016 13:04:52 -0800 Subject: [PATCH] getBaseAlignment: Round up structure sizes to max alignment --- glslang/MachineIndependent/linkValidate.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/glslang/MachineIndependent/linkValidate.cpp b/glslang/MachineIndependent/linkValidate.cpp index 7c96d225..664a8dff 100644 --- a/glslang/MachineIndependent/linkValidate.cpp +++ b/glslang/MachineIndependent/linkValidate.cpp @@ -959,6 +959,11 @@ int TIntermediate::getBaseAlignment(const TType& type, int& size, int& stride, b size += memberSize; } + // The structure may have padding at the end; the base offset of + // the member following the sub-structure is rounded up to the next + // multiple of the base alignment of the structure. + RoundToPow2(size, maxAlignment); + return maxAlignment; }