summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuri Rubinsky <chaosus89@gmail.com>2022-08-03 08:05:19 +0300
committerGitHub <noreply@github.com>2022-08-03 08:05:19 +0300
commit988041b74cdffc3a66bed53221335f9c5bda766e (patch)
tree22b8195f0097e9cbedf1d3ef70a7fe7e7a6e4a29
parent3b39f00761145a44a6c6d45320d6e26b944814a3 (diff)
parent779a5cd34a976ad945334d43263b07cddc0ef99a (diff)
Merge pull request #63847 from Zylann/shader_switch_uint
-rw-r--r--servers/rendering/shader_language.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/servers/rendering/shader_language.cpp b/servers/rendering/shader_language.cpp
index 7de175647b..019f10fe38 100644
--- a/servers/rendering/shader_language.cpp
+++ b/servers/rendering/shader_language.cpp
@@ -7158,9 +7158,12 @@ Error ShaderLanguage::_parse_block(BlockNode *p_block, const FunctionInfo &p_fun
if (!n) {
return ERR_PARSE_ERROR;
}
- if (n->get_datatype() != TYPE_INT) {
- _set_error(RTR("Expected an integer expression."));
- return ERR_PARSE_ERROR;
+ {
+ const ShaderLanguage::DataType switch_type = n->get_datatype();
+ if (switch_type != TYPE_INT && switch_type != TYPE_UINT) {
+ _set_error(RTR("Expected an integer expression."));
+ return ERR_PARSE_ERROR;
+ }
}
tk = _get_token();
if (tk.type != TK_PARENTHESIS_CLOSE) {