X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fglsl%2Fvalidate.h;h=a09f9f643002b11ecae0bfba1237d07d76121cd9;hb=1420854eb3827b8229bae2c2c6cebdd34a320f13;hp=52ae136bb61da6053f425cd1d70cc2ad87231be9;hpb=38712d8ecc57d043a2419ffbaeeb57f7a6586f14;p=libs%2Fgl.git diff --git a/source/glsl/validate.h b/source/glsl/validate.h index 52ae136b..a09f9f64 100644 --- a/source/glsl/validate.h +++ b/source/glsl/validate.h @@ -39,13 +39,14 @@ private: FUNCTION }; + Features features; ScopeType scope = GLOBAL; InterfaceLayout *iface_layout = 0; InterfaceBlock *iface_block = 0; VariableDeclaration *variable = 0; public: - void apply(Stage &s) { stage = &s; s.content.visit(*this); } + void apply(Stage &, const Features &); private: static const char *describe_variable(ScopeType); @@ -113,8 +114,16 @@ is indicated by a null result type. */ class ExpressionValidator: private Validator { private: + enum ConstantKind + { + NOT_CONSTANT, + FIXED_CONSTANT, + SPEC_CONSTANT + }; + FunctionDeclaration *current_function = 0; - bool constant_expression = false; + bool in_struct = false; + ConstantKind constant_expression = NOT_CONSTANT; public: void apply(Stage &s) { stage = &s; s.content.visit(*this); } @@ -127,6 +136,7 @@ private: virtual void visit(BinaryExpression &); virtual void visit(Assignment &); virtual void visit(TernaryExpression &); + virtual void visit(StructDeclaration &); virtual void visit(VariableDeclaration &); virtual void visit(FunctionDeclaration &); virtual void visit(Conditional &); @@ -165,8 +175,6 @@ public: void apply(Stage &s) { stage = &s; s.content.visit(*this); } private: - int get_location(const Layout &); - virtual void visit(VariableDeclaration &); virtual void visit(FunctionDeclaration &) { } };