From: Mikko Rasa Date: Tue, 9 Mar 2021 17:17:36 +0000 (+0200) Subject: Require GLSL functions to be declared before use X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=15562a0c458fd655b6907c285951085f38270e27;p=libs%2Fgl.git Require GLSL functions to be declared before use --- diff --git a/source/glsl/validate.cpp b/source/glsl/validate.cpp index 91d1de99..1458d01e 100644 --- a/source/glsl/validate.cpp +++ b/source/glsl/validate.cpp @@ -236,6 +236,13 @@ void ReferenceValidator::visit(InterfaceBlockReference &iface) error(iface, format("Use of unlinked input block '%s'", iface.name)); } +void ReferenceValidator::visit(FunctionCall &call) +{ + if(!call.declaration && !call.constructor) + error(call, format("Call to undeclared function '%s'", call.name)); + TraversingVisitor::visit(call); +} + void ReferenceValidator::visit(VariableDeclaration &var) { if(!var.type_declaration) diff --git a/source/glsl/validate.h b/source/glsl/validate.h index a8c6f11c..35cc049c 100644 --- a/source/glsl/validate.h +++ b/source/glsl/validate.h @@ -82,6 +82,7 @@ private: virtual void visit(VariableReference &); virtual void visit(MemberAccess &); virtual void visit(InterfaceBlockReference &); + virtual void visit(FunctionCall &); virtual void visit(VariableDeclaration &); virtual void visit(InterfaceBlock &); virtual void visit(FunctionDeclaration &);