From: Mikko Rasa Date: Sun, 7 Nov 2021 12:31:38 +0000 (+0200) Subject: Fix size calculation for GLSL arrays X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=23779cd03a8b1f6fdc3b2e4d8880170d3fa6146f;p=libs%2Fgl.git Fix size calculation for GLSL arrays --- diff --git a/source/glsl/reflect.cpp b/source/glsl/reflect.cpp index cc2e3a0c..8ee8a88d 100644 --- a/source/glsl/reflect.cpp +++ b/source/glsl/reflect.cpp @@ -320,7 +320,11 @@ void MemoryRequirementsCalculator::visit(VariableDeclaration &var) if(var.array) if(const Literal *literal = dynamic_cast(var.array_size.get())) if(literal->value.check_type()) - r_size += r_alignment*(literal->value.value()-1); + { + unsigned aligned_size = r_size+r_alignment-1; + aligned_size -= aligned_size%r_alignment; + r_size += aligned_size*(literal->value.value()-1); + } }