X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fglsl%2Fvalidate.cpp;h=8805d41fadf01655f7328b60e501ce8c3a8b73d4;hb=1476e64621ecbd7b17b00ae2c958322fd39918de;hp=91d1de991515dc74dbb359d0385a0429ef855803;hpb=7d66c70e15b84cbaf6b1973db07629f5bd3e5cdf;p=libs%2Fgl.git diff --git a/source/glsl/validate.cpp b/source/glsl/validate.cpp index 91d1de99..8805d41f 100644 --- a/source/glsl/validate.cpp +++ b/source/glsl/validate.cpp @@ -2,6 +2,7 @@ #include #include #include +#include #include "validate.h" using namespace std; @@ -236,6 +237,32 @@ 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) + { + map::iterator i = stage->functions.lower_bound(call.name); + if(i!=stage->functions.end() && i->second->name==call.name) + { + bool valid_types = true; + string signature; + for(NodeArray::const_iterator j=call.arguments.begin(); (valid_types && j!=call.arguments.end()); ++j) + { + if((*j)->type) + append(signature, ", ", (*j)->type->name); + else + valid_types = false; + } + + if(valid_types) + error(call, format("No matching overload found for call to '%s(%s)'", call.name, signature)); + } + else + error(call, format("Call to undeclared function '%s'", call.name)); + } + TraversingVisitor::visit(call); +} + void ReferenceValidator::visit(VariableDeclaration &var) { if(!var.type_declaration)