summaryrefslogtreecommitdiff
path: root/servers/rendering
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2022-01-13 14:04:00 +0100
committerGitHub <noreply@github.com>2022-01-13 14:04:00 +0100
commit99b46a2615905fa4b6af0cb78da3c8b1950d8b90 (patch)
tree58c7d4fce6a5d2b847c1f48fc8ebe611b63eb6be /servers/rendering
parentae06511bf6f9d1b32d66cb24dc648c3b94d3851b (diff)
parentb0356bcb72a4647699c8e9c7ab1370f563ef81bc (diff)
Merge pull request #56750 from Chaosus/shader_fix_main_function_decl
Diffstat (limited to 'servers/rendering')
-rw-r--r--servers/rendering/shader_language.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/servers/rendering/shader_language.cpp b/servers/rendering/shader_language.cpp
index adbcdedacc..c4d9ba4260 100644
--- a/servers/rendering/shader_language.cpp
+++ b/servers/rendering/shader_language.cpp
@@ -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);