Merge pull request #56750 from Chaosus/shader_fix_main_function_decl

This commit is contained in:
Rémi Verschelde 2022-01-13 14:04:00 +01:00 committed by GitHub
commit 99b46a2615
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 0 deletions

View File

@ -8774,6 +8774,13 @@ Error ShaderLanguage::_parse_shader(const Map<StringName, FunctionInfo> &p_funct
}
}
for (int i = 0; i < shader->functions.size(); i++) {
if (!shader->functions[i].callable && shader->functions[i].name == name) {
_set_error("Redefinition of '" + String(name) + "'");
return ERR_PARSE_ERROR;
}
}
ShaderNode::Function function;
function.callable = !p_functions.has(name);