]> git.tdb.fi Git - libs/gl.git/blobdiff - source/programsyntax.h
Remove the deprecated ProgramBuilder class
[libs/gl.git] / source / programsyntax.h
index 5e107a33a096232f2e3b3a0f93ed70ea36fe3b66..e7b5111ea2bfd5c411c853d99bffb32ff2f74aee 100644 (file)
@@ -7,6 +7,10 @@
 #include <vector>
 #include <msp/core/refptr.h>
 #include "extension.h"
+#include "uniform.h"
+
+#pragma push_macro("interface")
+#undef interface
 
 namespace Msp {
 namespace GL {
@@ -16,6 +20,9 @@ struct NodeVisitor;
 
 struct Node
 {
+protected:
+       Node() { }
+       Node(const Node &) { }
 private:
        Node &operator=(const Node &);
 public:
@@ -32,6 +39,7 @@ public:
        NodePtr() { }
        NodePtr(T *p): RefPtr<T>(p) { }
        NodePtr(const NodePtr &p): RefPtr<T>(p ? p->clone() : 0) { }
+       NodePtr &operator=(const NodePtr &p) { RefPtr<T>::operator=(p); return *this; }
 
        template<typename U>
        NodePtr(const RefPtr<U> &p): RefPtr<T>(p) { }
@@ -60,9 +68,19 @@ struct StructDeclaration;
 struct VariableDeclaration;
 struct FunctionDeclaration;
 
+struct Statement: Node
+{
+       unsigned source;
+       unsigned line;
+
+       Statement();
+
+       virtual Statement *clone() const = 0;
+};
+
 struct Block: Node
 {
-       NodeList<Node> body;
+       NodeList<Statement> body;
        bool use_braces;
        std::map<std::string, StructDeclaration *> types;
        std::map<std::string, VariableDeclaration *> variables;
@@ -162,7 +180,7 @@ struct FunctionCall: Expression
        virtual void visit(NodeVisitor &);
 };
 
-struct ExpressionStatement: Node
+struct ExpressionStatement: Statement
 {
        NodePtr<Expression> expression;
 
@@ -170,7 +188,7 @@ struct ExpressionStatement: Node
        virtual void visit(NodeVisitor &);
 };
 
-struct Import: Node
+struct Import: Statement
 {
        std::string module;
 
@@ -178,7 +196,7 @@ struct Import: Node
        virtual void visit(NodeVisitor &);
 };
 
-struct Precision: Node
+struct Precision: Statement
 {
        std::string precision;
        std::string type;
@@ -202,7 +220,7 @@ struct Layout: Node
        virtual void visit(NodeVisitor &);
 };
 
-struct InterfaceLayout: Node
+struct InterfaceLayout: Statement
 {
        std::string interface;
        Layout layout;
@@ -211,7 +229,7 @@ struct InterfaceLayout: Node
        virtual void visit(NodeVisitor &);
 };
 
-struct StructDeclaration: Node
+struct StructDeclaration: Statement
 {
        std::string name;
        Block members;
@@ -222,7 +240,7 @@ struct StructDeclaration: Node
        virtual void visit(NodeVisitor &);
 };
 
-struct VariableDeclaration: Node
+struct VariableDeclaration: Statement
 {
        bool constant;
        std::string sampling;
@@ -244,7 +262,7 @@ struct VariableDeclaration: Node
        virtual void visit(NodeVisitor &);
 };
 
-struct InterfaceBlock: Node
+struct InterfaceBlock: Statement
 {
        std::string interface;
        std::string name;
@@ -258,7 +276,7 @@ struct InterfaceBlock: Node
        virtual void visit(NodeVisitor &);
 };
 
-struct FunctionDeclaration: Node
+struct FunctionDeclaration: Statement
 {
        std::string return_type;
        std::string name;
@@ -273,7 +291,7 @@ struct FunctionDeclaration: Node
        virtual void visit(NodeVisitor &);
 };
 
-struct Conditional: Node
+struct Conditional: Statement
 {
        NodePtr<Expression> condition;
        Block body;
@@ -283,7 +301,7 @@ struct Conditional: Node
        virtual void visit(NodeVisitor &);
 };
 
-struct Iteration: Node
+struct Iteration: Statement
 {
        NodePtr<Node> init_statement;
        NodePtr<Expression> condition;
@@ -294,7 +312,7 @@ struct Iteration: Node
        virtual void visit(NodeVisitor &);
 };
 
-struct Passthrough: Node
+struct Passthrough: Statement
 {
        NodePtr<Expression> subscript;
 
@@ -302,7 +320,7 @@ struct Passthrough: Node
        virtual void visit(NodeVisitor &);
 };
 
-struct Return: Node
+struct Return: Statement
 {
        NodePtr<Expression> expression;
 
@@ -310,7 +328,7 @@ struct Return: Node
        virtual void visit(NodeVisitor &);
 };
 
-struct Jump: Node
+struct Jump: Statement
 {
        std::string keyword;
 
@@ -385,6 +403,7 @@ struct Stage
        std::map<std::string, VariableDeclaration *> out_variables;
        std::map<std::string, unsigned> locations;
        Version required_version;
+       std::vector<const Extension *> required_extensions;
 
        Stage(StageType);
 };
@@ -401,4 +420,6 @@ struct Module
 } // namespace GL
 } // namespace Msp
 
+#pragma pop_macro("interface")
+
 #endif