summaryrefslogtreecommitdiff
path: root/servers
diff options
context:
space:
mode:
authorYuri Roubinsky <chaosus89@gmail.com>2020-01-16 11:46:11 +0300
committerYuri Roubinsky <chaosus89@gmail.com>2020-01-16 11:46:11 +0300
commit5098232ee695ceca8d8e4536ac7cb142b0805abb (patch)
treedb7c23f37ca16837728f114f18cc0ecd6d3a1273 /servers
parent3af0400a32a2f81aad0b56940af0d6a92b6ffc92 (diff)
Disabled array initialization, const array and arr.length in shaders
Diffstat (limited to 'servers')
-rw-r--r--servers/visual/shader_language.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/servers/visual/shader_language.cpp b/servers/visual/shader_language.cpp
index 225b382524..2b61d72f6a 100644
--- a/servers/visual/shader_language.cpp
+++ b/servers/visual/shader_language.cpp
@@ -2060,7 +2060,7 @@ const ShaderLanguage::BuiltinFuncDef ShaderLanguage::builtin_func_defs[] = {
//sub-functions
//array
- { "length", TYPE_INT, { TYPE_VOID }, TAG_ARRAY, false },
+ { "length", TYPE_INT, { TYPE_VOID }, TAG_ARRAY, true },
{ NULL, TYPE_VOID, { TYPE_VOID }, TAG_GLOBAL, false }
@@ -3888,6 +3888,11 @@ Error ShaderLanguage::_parse_block(BlockNode *p_block, const Map<StringName, Bui
if (tk.type == TK_BRACKET_OPEN) {
bool unknown_size = false;
+ if (VisualServer::get_singleton()->is_low_end() && is_const) {
+ _set_error("Local const arrays are supported only on high-end platform!");
+ return ERR_PARSE_ERROR;
+ }
+
ArrayDeclarationNode *node = alloc_node<ArrayDeclarationNode>();
node->datatype = type;
node->precision = precision;
@@ -3923,6 +3928,12 @@ Error ShaderLanguage::_parse_block(BlockNode *p_block, const Map<StringName, Bui
tk = _get_token();
if (tk.type == TK_OP_ASSIGN) {
+
+ if (VisualServer::get_singleton()->is_low_end()) {
+ _set_error("Array initialization is supported only on high-end platform!");
+ return ERR_PARSE_ERROR;
+ }
+
tk = _get_token();
if (tk.type != TK_CURLY_BRACKET_OPEN) {