Browse Source

Merge pull request #63847 from Zylann/shader_switch_uint

Yuri Rubinsky 3 years ago
parent
commit
988041b74c
1 changed files with 6 additions and 3 deletions
  1. 6 3
      servers/rendering/shader_language.cpp

+ 6 - 3
servers/rendering/shader_language.cpp

@@ -7158,9 +7158,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."));
-				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();
 			tk = _get_token();
 			if (tk.type != TK_PARENTHESIS_CLOSE) {
 			if (tk.type != TK_PARENTHESIS_CLOSE) {