#include <vector>
#include <msp/core/refptr.h>
#include "extension.h"
+#include "uniform.h"
+
+#pragma push_macro("interface")
+#undef interface
namespace Msp {
namespace GL {
struct Node
{
+protected:
+ Node() { }
+ Node(const Node &) { }
private:
Node &operator=(const Node &);
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) { }
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;
virtual void visit(NodeVisitor &);
};
-struct ExpressionStatement: Node
+struct ExpressionStatement: Statement
{
NodePtr<Expression> expression;
virtual void visit(NodeVisitor &);
};
-struct Import: Node
+struct Import: Statement
{
std::string module;
virtual void visit(NodeVisitor &);
};
-struct Precision: Node
+struct Precision: Statement
{
std::string precision;
std::string type;
{
struct Qualifier
{
+ // TODO the standard calls this name, not identifier
std::string identifier;
std::string value;
};
virtual void visit(NodeVisitor &);
};
-struct InterfaceLayout: Node
+struct InterfaceLayout: Statement
{
std::string interface;
Layout layout;
virtual void visit(NodeVisitor &);
};
-struct StructDeclaration: Node
+struct StructDeclaration: Statement
{
std::string name;
Block members;
virtual void visit(NodeVisitor &);
};
-struct VariableDeclaration: Node
+struct VariableDeclaration: Statement
{
bool constant;
std::string sampling;
+ std::string interpolation;
std::string interface;
std::string precision;
std::string type;
virtual void visit(NodeVisitor &);
};
-struct InterfaceBlock: Node
+struct InterfaceBlock: Statement
{
std::string interface;
std::string name;
virtual void visit(NodeVisitor &);
};
-struct FunctionDeclaration: Node
+struct FunctionDeclaration: Statement
{
std::string return_type;
std::string name;
virtual void visit(NodeVisitor &);
};
-struct Conditional: Node
+struct Conditional: Statement
{
NodePtr<Expression> condition;
Block body;
virtual void visit(NodeVisitor &);
};
-struct Iteration: Node
+struct Iteration: Statement
{
NodePtr<Node> init_statement;
NodePtr<Expression> condition;
virtual void visit(NodeVisitor &);
};
-struct Passthrough: Node
+struct Passthrough: Statement
{
NodePtr<Expression> subscript;
virtual void visit(NodeVisitor &);
};
-struct Return: Node
+struct Return: Statement
{
NodePtr<Expression> expression;
virtual void visit(NodeVisitor &);
};
-struct Jump: Node
+struct Jump: Statement
{
std::string keyword;
std::map<std::string, VariableDeclaration *> out_variables;
std::map<std::string, unsigned> locations;
Version required_version;
+ std::vector<const Extension *> required_extensions;
Stage(StageType);
};
} // namespace GL
} // namespace Msp
+#pragma pop_macro("interface")
+
#endif