X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fprogramsyntax.h;h=590429519118614f6a59a83796da97f50693ff9c;hp=9e64c4c7e86896192748cefb24e29b2333ca1787;hb=56beca9d8b4f7b4edac81411d31e24df88e84ac3;hpb=a5772e203cc30ce3b449614d03a293fd5b5985ad diff --git a/source/programsyntax.h b/source/programsyntax.h index 9e64c4c7..59042951 100644 --- a/source/programsyntax.h +++ b/source/programsyntax.h @@ -7,6 +7,10 @@ #include #include #include "extension.h" +#include "uniform.h" + +#pragma push_macro("interface") +#undef interface namespace Msp { namespace GL { @@ -60,9 +64,19 @@ struct StructDeclaration; struct VariableDeclaration; struct FunctionDeclaration; +struct Statement: Node +{ + unsigned source; + unsigned line; + + Statement(); + + virtual Statement *clone() const = 0; +}; + struct Block: Node { - NodeList body; + NodeList body; bool use_braces; std::map types; std::map variables; @@ -162,7 +176,7 @@ struct FunctionCall: Expression virtual void visit(NodeVisitor &); }; -struct ExpressionStatement: Node +struct ExpressionStatement: Statement { NodePtr expression; @@ -170,7 +184,7 @@ struct ExpressionStatement: Node virtual void visit(NodeVisitor &); }; -struct Import: Node +struct Import: Statement { std::string module; @@ -178,7 +192,7 @@ struct Import: Node virtual void visit(NodeVisitor &); }; -struct Precision: Node +struct Precision: Statement { std::string precision; std::string type; @@ -191,6 +205,7 @@ struct Layout: Node { struct Qualifier { + // TODO the standard calls this name, not identifier std::string identifier; std::string value; }; @@ -201,7 +216,7 @@ struct Layout: Node virtual void visit(NodeVisitor &); }; -struct InterfaceLayout: Node +struct InterfaceLayout: Statement { std::string interface; Layout layout; @@ -210,7 +225,7 @@ struct InterfaceLayout: Node virtual void visit(NodeVisitor &); }; -struct StructDeclaration: Node +struct StructDeclaration: Statement { std::string name; Block members; @@ -221,10 +236,11 @@ struct StructDeclaration: Node 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; @@ -242,7 +258,7 @@ struct VariableDeclaration: Node virtual void visit(NodeVisitor &); }; -struct InterfaceBlock: Node +struct InterfaceBlock: Statement { std::string interface; std::string name; @@ -256,7 +272,7 @@ struct InterfaceBlock: Node virtual void visit(NodeVisitor &); }; -struct FunctionDeclaration: Node +struct FunctionDeclaration: Statement { std::string return_type; std::string name; @@ -271,7 +287,7 @@ struct FunctionDeclaration: Node virtual void visit(NodeVisitor &); }; -struct Conditional: Node +struct Conditional: Statement { NodePtr condition; Block body; @@ -281,7 +297,7 @@ struct Conditional: Node virtual void visit(NodeVisitor &); }; -struct Iteration: Node +struct Iteration: Statement { NodePtr init_statement; NodePtr condition; @@ -292,7 +308,7 @@ struct Iteration: Node virtual void visit(NodeVisitor &); }; -struct Passthrough: Node +struct Passthrough: Statement { NodePtr subscript; @@ -300,7 +316,7 @@ struct Passthrough: Node virtual void visit(NodeVisitor &); }; -struct Return: Node +struct Return: Statement { NodePtr expression; @@ -308,7 +324,7 @@ struct Return: Node virtual void visit(NodeVisitor &); }; -struct Jump: Node +struct Jump: Statement { std::string keyword; @@ -383,6 +399,7 @@ struct Stage std::map out_variables; std::map locations; Version required_version; + std::vector required_extensions; Stage(StageType); }; @@ -399,4 +416,6 @@ struct Module } // namespace GL } // namespace Msp +#pragma pop_macro("interface") + #endif