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
636a9d9f
Commit
636a9d9f
authored
Oct 11, 2019
by
Yuri Roubinsky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implemented global const array to shaders
parent
9562fb90
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
261 additions
and
11 deletions
+261
-11
shader_compiler_rd.cpp
servers/rendering/rasterizer_rd/shader_compiler_rd.cpp
+27
-0
shader_language.cpp
servers/rendering/shader_language.cpp
+229
-11
shader_language.h
servers/rendering/shader_language.h
+5
-0
No files found.
servers/rendering/rasterizer_rd/shader_compiler_rd.cpp
View file @
636a9d9f
...
...
@@ -711,6 +711,11 @@ String ShaderCompilerRD::_dump_node_code(const SL::Node *p_node, int p_level, Ge
gcode
+=
_typestr
(
cnode
.
type
);
}
gcode
+=
" "
+
_mkid
(
String
(
cnode
.
name
));
if
(
cnode
.
array_size
>
0
)
{
gcode
+=
"["
;
gcode
+=
itos
(
cnode
.
array_size
);
gcode
+=
"]"
;
}
gcode
+=
"="
;
gcode
+=
_dump_node_code
(
cnode
.
initializer
,
p_level
,
r_gen_code
,
p_actions
,
p_default_actions
,
p_assigning
);
gcode
+=
";
\n
"
;
...
...
@@ -988,7 +993,29 @@ String ShaderCompilerRD::_dump_node_code(const SL::Node *p_node, int p_level, Ge
}
break
;
case
SL
:
:
Node
::
TYPE_CONSTANT
:
{
SL
::
ConstantNode
*
cnode
=
(
SL
::
ConstantNode
*
)
p_node
;
if
(
cnode
->
array_size
==
0
)
{
return
get_constant_text
(
cnode
->
datatype
,
cnode
->
values
);
}
else
{
if
(
cnode
->
get_datatype
()
==
SL
::
TYPE_STRUCT
)
{
code
+=
_mkid
(
cnode
->
struct_name
);
}
else
{
code
+=
_typestr
(
cnode
->
datatype
);
}
code
+=
"["
;
code
+=
itos
(
cnode
->
array_size
);
code
+=
"]"
;
code
+=
"("
;
for
(
int
i
=
0
;
i
<
cnode
->
array_size
;
i
++
)
{
if
(
i
>
0
)
{
code
+=
","
;
}
else
{
code
+=
""
;
}
code
+=
_dump_node_code
(
cnode
->
array_declarations
[
0
].
initializer
[
i
],
p_level
,
r_gen_code
,
p_actions
,
p_default_actions
,
p_assigning
);
}
code
+=
")"
;
}
}
break
;
case
SL
:
:
Node
::
TYPE_OPERATOR
:
{
...
...
servers/rendering/shader_language.cpp
View file @
636a9d9f
This diff is collapsed.
Click to expand it.
servers/rendering/shader_language.h
View file @
636a9d9f
...
...
@@ -453,6 +453,8 @@ public:
struct
ConstantNode
:
public
Node
{
DataType
datatype
=
TYPE_VOID
;
String
struct_name
=
""
;
int
array_size
=
0
;
union
Value
{
bool
boolean
;
...
...
@@ -462,7 +464,9 @@ public:
};
Vector
<
Value
>
values
;
Vector
<
ArrayDeclarationNode
::
Declaration
>
array_declarations
;
virtual
DataType
get_datatype
()
const
{
return
datatype
;
}
virtual
String
get_datatype_name
()
const
{
return
struct_name
;
}
ConstantNode
()
:
Node
(
TYPE_CONSTANT
)
{}
...
...
@@ -573,6 +577,7 @@ public:
StringName
type_str
;
DataPrecision
precision
;
ConstantNode
*
initializer
;
int
array_size
;
};
struct
Function
{
...
...
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