From 33e2d239d0e473a585243de9d9db36e49edf184b Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Mon, 29 Nov 2021 01:02:54 +0200 Subject: [PATCH] Apply implicit conversions to function arguments --- source/glsl/resolve.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/source/glsl/resolve.cpp b/source/glsl/resolve.cpp index 3aeab30b..fbe60d79 100644 --- a/source/glsl/resolve.cpp +++ b/source/glsl/resolve.cpp @@ -1084,7 +1084,24 @@ void ExpressionResolver::visit(FunctionCall &call) TraversingVisitor::visit(call); if(call.declaration) + { + for(unsigned i=0; itype; + TypeDeclaration *param_type = call.declaration->parameters[i]->type_declaration; + BasicTypeDeclaration *arg_basic = dynamic_cast(arg_type); + BasicTypeDeclaration *param_basic = dynamic_cast(param_type); + if(arg_basic && param_basic) + { + Compatibility compat = get_compatibility(*param_basic, *arg_basic); + if(compat==RIGHT_CONVERTIBLE) + convert_to(call.arguments[i], *param_basic); + } + else if(!arg_type || !param_type || arg_type!=param_type) + return; + } resolve(call, call.declaration->return_type_declaration, false); + } else if(call.constructor) visit_constructor(call); } -- 2.45.2