1
0
mirror of https://github.com/godotengine/godot.git synced 2025-12-05 17:15:09 +00:00

Allow shading language to use switch statement with uints

This commit is contained in:
Marc Gilleron
2022-08-02 23:08:41 +01:00
parent f04004b24c
commit 779a5cd34a

View File

@@ -7153,9 +7153,12 @@ Error ShaderLanguage::_parse_block(BlockNode *p_block, const FunctionInfo &p_fun
if (!n) { if (!n) {
return ERR_PARSE_ERROR; return ERR_PARSE_ERROR;
} }
if (n->get_datatype() != TYPE_INT) { {
_set_error(RTR("Expected an integer expression.")); const ShaderLanguage::DataType switch_type = n->get_datatype();
return ERR_PARSE_ERROR; if (switch_type != TYPE_INT && switch_type != TYPE_UINT) {
_set_error(RTR("Expected an integer expression."));
return ERR_PARSE_ERROR;
}
} }
tk = _get_token(); tk = _get_token();
if (tk.type != TK_PARENTHESIS_CLOSE) { if (tk.type != TK_PARENTHESIS_CLOSE) {