]> git.tdb.fi Git - libs/gl.git/blobdiff - source/programsyntax.h
Rename ProgramSyntax::Context to Stage
[libs/gl.git] / source / programsyntax.h
index 11a67430926849adee88a32cb636bcde544d1736..86cb6b906181e7686d4230dbbe1b6fbeb9cb1556 100644 (file)
@@ -187,6 +187,7 @@ struct VariableDeclaration: Node
        bool array;
        NodePtr<Expression> array_size;
        NodePtr<Expression> init_expression;
+       VariableDeclaration *linked_declaration;
 
        VariableDeclaration();
 
@@ -241,6 +242,14 @@ struct Iteration: Node
        virtual void visit(NodeVisitor &);
 };
 
+struct Passthrough: Node
+{
+       NodePtr<Expression> subscript;
+
+       virtual Passthrough *clone() const { return new Passthrough(*this); }
+       virtual void visit(NodeVisitor &);
+};
+
 struct Return: Node
 {
        NodePtr<Expression> expression;
@@ -269,6 +278,7 @@ struct NodeVisitor
        virtual void visit(FunctionDeclaration &) { }
        virtual void visit(Conditional &) { }
        virtual void visit(Iteration &) { }
+       virtual void visit(Passthrough &) { }
        virtual void visit(Return &) { }
 };
 
@@ -287,32 +297,36 @@ struct TraversingVisitor: NodeVisitor
        virtual void visit(FunctionDeclaration &);
        virtual void visit(Conditional &);
        virtual void visit(Iteration &);
+       virtual void visit(Passthrough &);
        virtual void visit(Return &);
 };
 
-enum ContextType
+enum StageType
 {
-       GLOBAL,
+       SHARED,
        VERTEX,
        GEOMETRY,
        FRAGMENT
 };
 
-struct Context
+struct Stage
 {
-       ContextType type;
+       StageType type;
        bool present;
+       Stage *previous;
        ProgramSyntax::Block content;
+       std::map<std::string, VariableDeclaration *> in_variables;
+       std::map<std::string, VariableDeclaration *> out_variables;
 
-       Context(ContextType);
+       Stage(StageType);
 };
 
 struct Module
 {
-       Context global_context;
-       Context vertex_context;
-       Context geometry_context;
-       Context fragment_context;
+       Stage shared;
+       Stage vertex_stage;
+       Stage geometry_stage;
+       Stage fragment_stage;
 
        Module();
 };