]> git.tdb.fi Git - libs/gl.git/blobdiff - source/glsl/visitor.h
Refactor FunctionInliner to do any necessary declaration reordering
[libs/gl.git] / source / glsl / visitor.h
index 4e48a1a11f112205ec10feedf2017d6c7099ddd1..e0d74f6226927299913e3e9d41892042eb52f6bb 100644 (file)
@@ -106,9 +106,27 @@ private:
        virtual void visit(StructDeclaration &);
        virtual void visit(VariableDeclaration &);
        virtual void visit(InterfaceBlock &);
+       virtual void visit(FunctionDeclaration &);
        virtual void visit(Iteration &);
 };
 
+/** Reorders a set of nodes so they appear before another node.  Only nodes
+on the same hierarchly level as the target node are reordered. */
+class NodeReorderer: private TraversingVisitor
+{
+private:
+       Node *reorder_before;
+       const std::set<Node *> *to_reorder;
+
+public:
+       NodeReorderer();
+
+       void apply(Stage &, Node &, const std::set<Node *> &);
+
+private:
+       virtual void visit(Block &);
+};
+
 } // namespace SL
 } // namespace GL
 } // namespace Msp