X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fglsl%2Fgenerate.h;h=a728e99ced3a8bccd24aaa89de94cbbddee09664;hp=54e39f39aa0679088ea7d18dd98192c32645f07c;hb=c1d3a1d7c1997bc71a30af2e2c25cb4a2b66784b;hpb=4414f0245005c8cfcd02b51ea394d612cc5776c4 diff --git a/source/glsl/generate.h b/source/glsl/generate.h index 54e39f39..a728e99c 100644 --- a/source/glsl/generate.h +++ b/source/glsl/generate.h @@ -48,8 +48,13 @@ private: /** Forms links between nested blocks in the syntax tree. */ class BlockHierarchyResolver: private TraversingVisitor { +private: + bool r_any_resolved; + public: - void apply(Stage &s) { s.content.visit(*this); } + BlockHierarchyResolver(): r_any_resolved(false) { } + + bool apply(Stage &s) { r_any_resolved = false; s.content.visit(*this); return r_any_resolved; } private: virtual void enter(Block &); @@ -63,14 +68,16 @@ private: std::map alias_map; std::map array_types; NodeList::iterator type_insert_point; + bool r_any_resolved; public: TypeResolver(); - void apply(Stage &); + bool apply(Stage &); private: - TypeDeclaration *resolve_type(const std::string &); + TypeDeclaration *get_or_create_array_type(TypeDeclaration &); + void resolve_type(TypeDeclaration *&, const std::string &, bool); virtual void visit(Block &); virtual void visit(BasicTypeDeclaration &); virtual void visit(ImageTypeDeclaration &); @@ -164,9 +171,10 @@ class FunctionResolver: private TraversingVisitor private: Stage *stage; std::map > declarations; + bool r_any_resolved; public: - void apply(Stage &); + bool apply(Stage &); private: virtual void visit(FunctionCall &);