From: Mikko Rasa Date: Tue, 9 Mar 2021 12:31:22 +0000 (+0200) Subject: Properly use r_any_resolved in FunctionResolver X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=7f2ffe6e62bc7d7b2af7d3c3cccc57f87d8bf90f;p=libs%2Fgl.git Properly use r_any_resolved in FunctionResolver Apparently lacking this has not caused any trouble so far, but it would soon. --- diff --git a/source/glsl/generate.cpp b/source/glsl/generate.cpp index 1f229991..113b4324 100644 --- a/source/glsl/generate.cpp +++ b/source/glsl/generate.cpp @@ -917,8 +917,9 @@ bool FunctionResolver::apply(Stage &s) void FunctionResolver::visit(FunctionCall &call) { map::iterator i = stage->functions.find(call.name); - if(i!=stage->functions.end()) - call.declaration = i->second; + FunctionDeclaration *declaration = (i!=stage->functions.end() ? i->second : 0); + r_any_resolved |= (declaration!=call.declaration); + call.declaration = declaration; TraversingVisitor::visit(call); } @@ -934,17 +935,19 @@ void FunctionResolver::visit(FunctionDeclaration &func) // Set all previous declarations to use this definition. for(vector::iterator i=decls.begin(); i!=decls.end(); ++i) { + r_any_resolved |= (func.definition!=(*i)->definition); (*i)->definition = func.definition; (*i)->body.body.clear(); } } else { - func.definition = 0; + FunctionDeclaration *definition = (stage_decl ? stage_decl->definition : 0); + r_any_resolved |= (definition!=func.definition); + func.definition = definition; + if(!stage_decl) stage_decl = &func; - else - func.definition = stage_decl->definition; } decls.push_back(&func);