summaryrefslogtreecommitdiff
path: root/servers
diff options
context:
space:
mode:
authorMarc Gilleron <marc.gilleron@gmail.com>2022-08-02 23:08:41 +0100
committerMarc Gilleron <marc.gilleron@gmail.com>2022-08-02 23:08:41 +0100
commit779a5cd34a976ad945334d43263b07cddc0ef99a (patch)
treed294f514510ea1050b86b7a8cb4f1064bdc0d997 /servers
parentf04004b24c5844d4974db1ce55e7059fc007d4f9 (diff)
Allow shading language to use `switch` statement with uints
Diffstat (limited to 'servers')
-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 2dd0f7006b..adf41dbb80 100644
--- a/servers/rendering/shader_language.cpp
+++ b/servers/rendering/shader_language.cpp
@@ -7153,9 +7153,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) {