From: Mikko Rasa Date: Sun, 7 Nov 2021 13:59:13 +0000 (+0200) Subject: Padding is required at the end of certain SPIR-V struct members X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=c1bf0909af97772da5b26d82272f337a14c1fae9;p=libs%2Fgl.git Padding is required at the end of certain SPIR-V struct members If the member is is itself a struct or an array, the next member must not begin before the next alignment boundary. --- diff --git a/source/glsl/reflect.cpp b/source/glsl/reflect.cpp index 8ee8a88d..6027acde 100644 --- a/source/glsl/reflect.cpp +++ b/source/glsl/reflect.cpp @@ -304,6 +304,8 @@ void MemoryRequirementsCalculator::visit(StructDeclaration &strct) } r_size = total; r_alignment = max_align; + r_size += r_alignment-1; + r_size -= r_size%r_alignment; } void MemoryRequirementsCalculator::visit(VariableDeclaration &var) @@ -323,7 +325,7 @@ void MemoryRequirementsCalculator::visit(VariableDeclaration &var) { unsigned aligned_size = r_size+r_alignment-1; aligned_size -= aligned_size%r_alignment; - r_size += aligned_size*(literal->value.value()-1); + r_size = aligned_size*literal->value.value(); } }