Skip to content

Commit

Permalink
Fix using post-init shader array constructors
Browse files Browse the repository at this point in the history
  • Loading branch information
Chaosus committed Dec 26, 2020
1 parent fb16b1e commit bc0e8e7
Show file tree
Hide file tree
Showing 3 changed files with 179 additions and 144 deletions.
13 changes: 8 additions & 5 deletions servers/rendering/renderer_rd/shader_compiler_rd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -920,7 +920,7 @@ String ShaderCompilerRD::_dump_node_code(const SL::Node *p_node, int p_level, Ge
if (adnode->datatype == SL::TYPE_STRUCT) {
declaration += _mkid(adnode->struct_name);
} else {
declaration = _prestr(adnode->precision) + _typestr(adnode->datatype);
declaration += _prestr(adnode->precision) + _typestr(adnode->datatype);
}
for (int i = 0; i < adnode->declarations.size(); i++) {
if (i > 0) {
Expand Down Expand Up @@ -990,12 +990,13 @@ String ShaderCompilerRD::_dump_node_code(const SL::Node *p_node, int p_level, Ge
if (anode->call_expression != nullptr) {
code += ".";
code += _dump_node_code(anode->call_expression, p_level, r_gen_code, p_actions, p_default_actions, p_assigning, false);
}

if (anode->index_expression != nullptr) {
} else if (anode->index_expression != nullptr) {
code += "[";
code += _dump_node_code(anode->index_expression, p_level, r_gen_code, p_actions, p_default_actions, p_assigning);
code += "]";
} else if (anode->assign_expression != nullptr) {
code += "=";
code += _dump_node_code(anode->assign_expression, p_level, r_gen_code, p_actions, p_default_actions, true, false);
}

if (anode->name == time_name) {
Expand Down Expand Up @@ -1233,8 +1234,10 @@ String ShaderCompilerRD::_dump_node_code(const SL::Node *p_node, int p_level, Ge
code += "[";
code += _dump_node_code(mnode->index_expression, p_level, r_gen_code, p_actions, p_default_actions, p_assigning);
code += "]";
} else if (mnode->assign_expression != nullptr) {
code += "=";
code += _dump_node_code(mnode->assign_expression, p_level, r_gen_code, p_actions, p_default_actions, true, false);
}

} break;
}

Expand Down
Loading

0 comments on commit bc0e8e7

Please sign in to comment.