]> git.tdb.fi Git - libs/gl.git/blobdiff - source/glsl/syntax.h
Mostly cosmetic tweaks
[libs/gl.git] / source / glsl / syntax.h
index 70b1bb39f3547d2f3fb838fe8359d5aa979b5e1c..55f47402f514538b959a459a07b3532e2a0d5efd 100644 (file)
@@ -3,6 +3,7 @@
 
 #include <list>
 #include <map>
+#include <set>
 #include <string>
 #include <vector>
 #include <msp/core/refptr.h>
@@ -90,6 +91,7 @@ class NodeArray: public NodeContainer<std::vector<RefPtr<T> > >
 
 struct StructDeclaration;
 struct VariableDeclaration;
+struct InterfaceBlock;
 struct FunctionDeclaration;
 
 struct Statement: Node
@@ -106,8 +108,7 @@ struct Block: Node
 {
        NodeList<Statement> body;
        bool use_braces;
-       bool anonymous;
-       std::map<std::string, StructDeclaration *> types;
+
        std::map<std::string, VariableDeclaration *> variables;
        Block *parent;
 
@@ -142,6 +143,7 @@ struct ParenthesizedExpression: Expression
 struct VariableReference: Expression
 {
        std::string name;
+
        VariableDeclaration *declaration;
 
        VariableReference();
@@ -151,10 +153,24 @@ struct VariableReference: Expression
        virtual void visit(NodeVisitor &);
 };
 
+struct InterfaceBlockReference: Expression
+{
+       std::string name;
+
+       InterfaceBlock *declaration;
+
+       InterfaceBlockReference();
+       InterfaceBlockReference(const InterfaceBlockReference &);
+
+       virtual InterfaceBlockReference *clone() const { return new InterfaceBlockReference(*this); }
+       virtual void visit(NodeVisitor &);
+};
+
 struct MemberAccess: Expression
 {
        NodePtr<Expression> left;
        std::string member;
+
        VariableDeclaration *declaration;
 
        MemberAccess();
@@ -190,6 +206,7 @@ struct BinaryExpression: Expression
 struct Assignment: BinaryExpression
 {
        bool self_referencing;
+
        VariableDeclaration *target_declaration;
 
        Assignment();
@@ -202,10 +219,11 @@ struct Assignment: BinaryExpression
 struct FunctionCall: Expression
 {
        std::string name;
-       FunctionDeclaration *declaration;
        bool constructor;
        NodeArray<Expression> arguments;
 
+       FunctionDeclaration *declaration;
+
        FunctionCall();
        FunctionCall(const FunctionCall &);
 
@@ -275,22 +293,24 @@ struct StructDeclaration: Statement
 
 struct VariableDeclaration: Statement
 {
+       NodePtr<Layout> layout;
        bool constant;
        std::string sampling;
        std::string interpolation;
        std::string interface;
        std::string precision;
        std::string type;
-       StructDeclaration *type_declaration;
        std::string name;
        bool array;
        NodePtr<Expression> array_size;
        NodePtr<Expression> init_expression;
+
+       StructDeclaration *type_declaration;
        VariableDeclaration *linked_declaration;
-       NodePtr<Layout> layout;
 
        VariableDeclaration();
        VariableDeclaration(const VariableDeclaration &);
+       ~VariableDeclaration();
 
        virtual VariableDeclaration *clone() const { return new VariableDeclaration(*this); }
        virtual void visit(NodeVisitor &);
@@ -304,7 +324,11 @@ struct InterfaceBlock: Statement
        std::string instance_name;
        bool array;
 
+       InterfaceBlock *linked_block;
+
        InterfaceBlock();
+       InterfaceBlock(const InterfaceBlock &);
+       ~InterfaceBlock();
 
        virtual InterfaceBlock *clone() const { return new InterfaceBlock(*this); }
        virtual void visit(NodeVisitor &);
@@ -315,9 +339,10 @@ struct FunctionDeclaration: Statement
        std::string return_type;
        std::string name;
        NodeArray<VariableDeclaration> parameters;
-       FunctionDeclaration *definition;
        Block body;
 
+       FunctionDeclaration *definition;
+
        FunctionDeclaration();
        FunctionDeclaration(const FunctionDeclaration &);
 
@@ -383,8 +408,8 @@ struct Stage
        Type type;
        Stage *previous;
        Block content;
-       std::map<std::string, VariableDeclaration *> in_variables;
-       std::map<std::string, VariableDeclaration *> out_variables;
+       std::map<std::string, StructDeclaration *> types;
+       std::map<std::string, InterfaceBlock *> interface_blocks;
        std::map<std::string, unsigned> locations;
        Features required_features;