Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
godot
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
community
godot
Commits
e329cd60
Unverified
Commit
e329cd60
authored
Jan 16, 2020
by
Rémi Verschelde
Committed by
GitHub
Jan 16, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #35189 from Chaosus/disable_gles2_array_init
Disabled array initialization, const array and arr.length in GLES2 shaders
parents
fc2550c4
5098232e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
20 deletions
+12
-20
shader_compiler_gles2.cpp
drivers/gles2/shader_compiler_gles2.cpp
+0
-19
shader_language.cpp
servers/visual/shader_language.cpp
+12
-1
No files found.
drivers/gles2/shader_compiler_gles2.cpp
View file @
e329cd60
...
@@ -522,9 +522,6 @@ String ShaderCompilerGLES2::_dump_node_code(SL::Node *p_node, int p_level, Gener
...
@@ -522,9 +522,6 @@ String ShaderCompilerGLES2::_dump_node_code(SL::Node *p_node, int p_level, Gener
SL
::
ArrayDeclarationNode
*
arr_dec_node
=
(
SL
::
ArrayDeclarationNode
*
)
p_node
;
SL
::
ArrayDeclarationNode
*
arr_dec_node
=
(
SL
::
ArrayDeclarationNode
*
)
p_node
;
StringBuffer
<>
declaration
;
StringBuffer
<>
declaration
;
if
(
arr_dec_node
->
is_const
)
{
declaration
+=
"const "
;
}
declaration
+=
_prestr
(
arr_dec_node
->
precision
);
declaration
+=
_prestr
(
arr_dec_node
->
precision
);
declaration
+=
_typestr
(
arr_dec_node
->
datatype
);
declaration
+=
_typestr
(
arr_dec_node
->
datatype
);
...
@@ -540,22 +537,6 @@ String ShaderCompilerGLES2::_dump_node_code(SL::Node *p_node, int p_level, Gener
...
@@ -540,22 +537,6 @@ String ShaderCompilerGLES2::_dump_node_code(SL::Node *p_node, int p_level, Gener
declaration
+=
"["
;
declaration
+=
"["
;
declaration
+=
itos
(
arr_dec_node
->
declarations
[
i
].
size
);
declaration
+=
itos
(
arr_dec_node
->
declarations
[
i
].
size
);
declaration
+=
"]"
;
declaration
+=
"]"
;
int
sz
=
arr_dec_node
->
declarations
[
i
].
initializer
.
size
();
if
(
sz
>
0
)
{
declaration
+=
"="
;
declaration
+=
_typestr
(
arr_dec_node
->
datatype
);
declaration
+=
"["
;
declaration
+=
itos
(
sz
);
declaration
+=
"]"
;
declaration
+=
"("
;
for
(
int
j
=
0
;
j
<
sz
;
j
++
)
{
declaration
+=
_dump_node_code
(
arr_dec_node
->
declarations
[
i
].
initializer
[
j
],
p_level
,
r_gen_code
,
p_actions
,
p_default_actions
,
p_assigning
);
if
(
j
!=
sz
-
1
)
{
declaration
+=
", "
;
}
}
declaration
+=
")"
;
}
}
}
code
+=
declaration
.
as_string
();
code
+=
declaration
.
as_string
();
...
...
servers/visual/shader_language.cpp
View file @
e329cd60
...
@@ -2060,7 +2060,7 @@ const ShaderLanguage::BuiltinFuncDef ShaderLanguage::builtin_func_defs[] = {
...
@@ -2060,7 +2060,7 @@ const ShaderLanguage::BuiltinFuncDef ShaderLanguage::builtin_func_defs[] = {
//sub-functions
//sub-functions
//array
//array
{
"length"
,
TYPE_INT
,
{
TYPE_VOID
},
TAG_ARRAY
,
fals
e
},
{
"length"
,
TYPE_INT
,
{
TYPE_VOID
},
TAG_ARRAY
,
tru
e
},
{
NULL
,
TYPE_VOID
,
{
TYPE_VOID
},
TAG_GLOBAL
,
false
}
{
NULL
,
TYPE_VOID
,
{
TYPE_VOID
},
TAG_GLOBAL
,
false
}
...
@@ -3888,6 +3888,11 @@ Error ShaderLanguage::_parse_block(BlockNode *p_block, const Map<StringName, Bui
...
@@ -3888,6 +3888,11 @@ Error ShaderLanguage::_parse_block(BlockNode *p_block, const Map<StringName, Bui
if
(
tk
.
type
==
TK_BRACKET_OPEN
)
{
if
(
tk
.
type
==
TK_BRACKET_OPEN
)
{
bool
unknown_size
=
false
;
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
>
();
ArrayDeclarationNode
*
node
=
alloc_node
<
ArrayDeclarationNode
>
();
node
->
datatype
=
type
;
node
->
datatype
=
type
;
node
->
precision
=
precision
;
node
->
precision
=
precision
;
...
@@ -3923,6 +3928,12 @@ Error ShaderLanguage::_parse_block(BlockNode *p_block, const Map<StringName, Bui
...
@@ -3923,6 +3928,12 @@ Error ShaderLanguage::_parse_block(BlockNode *p_block, const Map<StringName, Bui
tk
=
_get_token
();
tk
=
_get_token
();
if
(
tk
.
type
==
TK_OP_ASSIGN
)
{
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
();
tk
=
_get_token
();
if
(
tk
.
type
!=
TK_CURLY_BRACKET_OPEN
)
{
if
(
tk
.
type
!=
TK_CURLY_BRACKET_OPEN
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment