X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fglsl%2Fvalidate.h;fp=source%2Fglsl%2Fvalidate.h;h=63af3610a3b9a81e7bc3c73921eb6c16c3808964;hb=20a86c5905e1f7527d3c9edc3f56f6b7679c268a;hp=f1e3f5126eb8422624524979a8768165b5451396;hpb=1c2c36f1342df84ff195d8c58347c5e875590e0e;p=libs%2Fgl.git diff --git a/source/glsl/validate.h b/source/glsl/validate.h index f1e3f512..63af3610 100644 --- a/source/glsl/validate.h +++ b/source/glsl/validate.h @@ -127,6 +127,48 @@ private: virtual void visit(Return &); }; +class StageInterfaceValidator: private Validator +{ +private: + std::map > used_locations; + +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 &) { } +}; + +class GlobalInterfaceValidator: private Validator +{ +private: + struct Binding + { + Node *node; + TypeDeclaration *type; + std::string name; + + Binding(VariableDeclaration &v): node(&v), type(v.type_declaration), name(v.name) { } + Binding(InterfaceBlock &i): node(&i), type(i.struct_declaration), name(i.block_name) { } + }; + + std::map > used_bindings; + +public: + void apply(Module &); + +private: + void get_binding(const Layout &, unsigned &, int &); + void check_binding(const Layout &, const Binding &); + + virtual void visit(VariableDeclaration &); + virtual void visit(InterfaceBlock &); + virtual void visit(FunctionDeclaration &) { } +}; + } // namespace SL } // namespace GL } // namespace Msp