X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fglsl%2Fvalidate.h;h=7f8339f678adf71e17418ee26eff983f9c36fc23;hp=acb5b4e4086810972263a03ad5f2cb065fc205d1;hb=70d9d2d28e5fe723c6b46894276e4c935f578e2d;hpb=db349c75a9563d38afaf1a8a602d9ee1155d62bb diff --git a/source/glsl/validate.h b/source/glsl/validate.h index acb5b4e4..7f8339f6 100644 --- a/source/glsl/validate.h +++ b/source/glsl/validate.h @@ -10,6 +10,8 @@ namespace Msp { namespace GL { namespace SL { +/** Base class for validators. Contains some utilities for adding diagnostic +messages. */ class Validator: protected TraversingVisitor { protected: @@ -24,6 +26,7 @@ protected: void add_info(Node &, const std::string &); }; +/** Verifies that declarations are valid in isolation. */ class DeclarationValidator: private Validator { private: @@ -59,6 +62,8 @@ private: virtual void visit(FunctionDeclaration &); }; +/** Verifies that identifiers are unique or, in the case of functions, are +overloaded only in valid ways. */ class IdentifierValidator: private Validator { private: @@ -89,6 +94,7 @@ private: virtual void visit(FunctionDeclaration &); }; +/** Verifies that there are no unresolved references. */ class ReferenceValidator: private Validator { public: @@ -106,6 +112,8 @@ private: virtual void visit(FunctionDeclaration &); }; +/** Verifies that expressions are valid. In most cases an invalid expression +is indicated by a null result type. */ class ExpressionValidator: private Validator { private: @@ -127,6 +135,9 @@ private: virtual void visit(Return &); }; +/** Verifies that stage input and output interfaces are valid. Linked +variables must have matching types and locations and there must not be any +overlap in locations. */ class StageInterfaceValidator: private Validator { private: @@ -142,6 +153,8 @@ private: virtual void visit(FunctionDeclaration &) { } }; +/** Verifies that uniform interfaces are valid across the entire module. +Variables declared with the same binding must have the same name and type. */ class GlobalInterfaceValidator: private Validator { private: