NodePtr(T *n = 0): node(n) { }
NodePtr(const NodePtr &p): node(clone(p.node)) { }
NodePtr &operator=(const NodePtr &p) { delete node; node = clone(p.node); return *this; }
+#if __cplusplus>=201103L
+ NodePtr(NodePtr &&p): node(p.node) { p.node = 0; }
+ NodePtr &operator=(NodePtr &&p) { delete node; node = p.node; p.node = 0; return *this; }
+#endif
~NodePtr() { delete node; }
private:
std::string interface;
std::string name;
Block members;
+ std::string instance_name;
+ bool array;
InterfaceBlock();
struct Conditional: Node
{
- Expression *condition;
+ NodePtr<Expression> condition;
Block body;
Block else_body;
virtual void visit(Return &);
};
-enum ContextType
+enum StageType
{
- GLOBAL,
+ SHARED,
VERTEX,
GEOMETRY,
FRAGMENT
};
-struct Context
+struct Stage
{
- ContextType type;
- bool present;
- Context *previous;
+ StageType type;
+ 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;
+ std::list<Stage> stages;
Module();
};