X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fglsl%2Fvalidate.h;h=acb5b4e4086810972263a03ad5f2cb065fc205d1;hb=8f5f54a9e165dae424e5b0bb8e488c3d01849bf6;hp=f1e3f5126eb8422624524979a8768165b5451396;hpb=f2ad2730858046b08e8147297fa01bf3499b86a3;p=libs%2Fgl.git diff --git a/source/glsl/validate.h b/source/glsl/validate.h index f1e3f512..acb5b4e4 100644 --- a/source/glsl/validate.h +++ b/source/glsl/validate.h @@ -127,6 +127,53 @@ 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 Uniform + { + Node *node; + TypeDeclaration *type; + std::string name; + int location; + unsigned loc_count; + int desc_set; + int bind_point; + + Uniform(): node(0), type(0), location(-1), loc_count(1), desc_set(0), bind_point(-1) { } + }; + + std::list uniforms; + std::map used_names; + std::map used_locations; + std::map > used_bindings; + +public: + void apply(Module &); + +private: + void check_uniform(const Uniform &); + + virtual void visit(VariableDeclaration &); + virtual void visit(InterfaceBlock &); + virtual void visit(FunctionDeclaration &) { } +}; + } // namespace SL } // namespace GL } // namespace Msp