X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fglsl%2Freflect.h;h=8de915729ce50e8748c9e8011419d5bd4f7cf6b8;hp=c2d7aa0483bd36e4411a55c2d5325158dfae1b92;hb=cc5483cc709fdf7b6966a3e69dabfcafebaaffa0;hpb=577a93f39f9b4d0f5101cd2f539fc774e7b06825 diff --git a/source/glsl/reflect.h b/source/glsl/reflect.h index c2d7aa04..8de91572 100644 --- a/source/glsl/reflect.h +++ b/source/glsl/reflect.h @@ -53,7 +53,7 @@ private: virtual void visit(VariableDeclaration &); }; -/** Determines the size and alignment of a variable, in bytes. */ +/** Determines the size and alignment of a variable or a type, in bytes. */ class MemoryRequirementsCalculator: private NodeVisitor { public: @@ -61,8 +61,9 @@ public: { unsigned size; unsigned alignment; + unsigned stride; - Result(unsigned s, unsigned a): size(s), alignment(a) { } + Result(unsigned s, unsigned a): size(s), alignment(a), stride(s+a-1-(s+a-1)%a) { } }; private: unsigned r_size; @@ -71,6 +72,7 @@ private: public: Result apply(VariableDeclaration &v) { v.visit(*this); return Result(r_size, r_alignment); } + Result apply(TypeDeclaration &t) { t.visit(*this); return Result(r_size, r_alignment); } private: virtual void visit(BasicTypeDeclaration &);