From 7f2ffe6e62bc7d7b2af7d3c3cccc57f87d8bf90f Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Tue, 9 Mar 2021 14:31:22 +0200 Subject: [PATCH] Properly use r_any_resolved in FunctionResolver Apparently lacking this has not caused any trouble so far, but it would soon. --- source/glsl/generate.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) 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); -- 2.45.2