1 #ifndef MSP_GL_SL_VALIDATE_H_
2 #define MSP_GL_SL_VALIDATE_H_
6 #include "glsl_error.h"
13 class Validator: protected TraversingVisitor
20 void diagnose(Statement *, Diagnostic::Severity, const std::string &);
21 void error(Statement *s, const std::string &m) { diagnose(s, Diagnostic::ERR, m); }
24 class DeclarationValidator: private Validator
27 typedef std::map<std::string, Statement *> BlockDeclarationMap;
29 std::map<Block *, BlockDeclarationMap> declarations;
33 DeclarationValidator();
35 void apply(Stage &s) { stage = &s; s.content.visit(*this); }
38 Statement *find_definition(const std::string &);
39 void check_definition(const std::string &, Statement &);
41 virtual void visit(VariableDeclaration &);
42 virtual void visit(InterfaceBlock &);
43 virtual void visit(FunctionDeclaration &);