@@ -3867,7 +3867,7 @@ bool ShaderLanguage::_validate_function_call(BlockNode *p_block, const FunctionI
38673867 String arg_list = " " ;
38683868
38693869 for (int i = 0 ; i < shader->vfunctions .size (); i++) {
3870- if (name != shader->vfunctions [i].name ) {
3870+ if (rname != shader->vfunctions [i].rname ) {
38713871 continue ;
38723872 }
38733873 exists = true ;
@@ -6155,23 +6155,21 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
61556155 bnode = bnode->parent_block ;
61566156 }
61576157
6158+ int64_t arg_count = func->arguments .size ();
6159+ int64_t arg_count2 = func->arguments .size () - 1 ;
6160+
61586161 // Test if function was parsed first.
61596162 int function_index = -1 ;
61606163 for (int i = 0 , max_valid_args = 0 ; i < shader->vfunctions .size (); i++) {
6161- if (!shader->vfunctions [i].callable || shader->vfunctions [i].rname != rname) {
6164+ if (!shader->vfunctions [i].callable || shader->vfunctions [i].rname != rname || arg_count2 != shader-> vfunctions [i]. function -> arguments . size () ) {
61626165 continue ;
61636166 }
61646167
61656168 bool found = true ;
61666169 int valid_args = 0 ;
61676170
61686171 // Search for correct overload.
6169- for (int j = 1 ; j < func->arguments .size (); j++) {
6170- if (j - 1 == shader->vfunctions [i].function ->arguments .size ()) {
6171- found = false ;
6172- break ;
6173- }
6174-
6172+ for (int j = 1 ; j < arg_count; j++) {
61756173 const FunctionNode::Argument &a = shader->vfunctions [i].function ->arguments [j - 1 ];
61766174 Node *b = func->arguments [j];
61776175
@@ -6313,7 +6311,7 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
63136311
63146312 for (int i = 0 ; i < call_function->arguments .size (); i++) {
63156313 int argidx = i + 1 ;
6316- if (argidx < func-> arguments . size () ) {
6314+ if (argidx < arg_count ) {
63176315 bool error = false ;
63186316 Node *n = func->arguments [argidx];
63196317 ArgumentQualifier arg_qual = call_function->arguments [i].qualifier ;
0 commit comments