diff options
author | Thaddeus Crews <repiteo@outlook.com> | 2024-11-11 14:18:23 -0600 |
---|---|---|
committer | Thaddeus Crews <repiteo@outlook.com> | 2024-11-11 14:18:23 -0600 |
commit | e5b77b184f3547289256d40f04b8bc6a7efdc055 (patch) | |
tree | 114707bb2cd572dce68bc519229745d634153239 /servers | |
parent | 85c5a4f05866128d1ceacb64a6b5cea39cdcbefa (diff) | |
parent | 5efe8ccdead82e10fcfc68779d1872ca75bddfe3 (diff) | |
download | redot-engine-e5b77b184f3547289256d40f04b8bc6a7efdc055.tar.gz |
Merge pull request #98755 from Chaosus/shader_compiler_fix_struct_member_names
Add prefix to struct member names in shader compiler
Diffstat (limited to 'servers')
-rw-r--r-- | servers/rendering/shader_compiler.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/servers/rendering/shader_compiler.cpp b/servers/rendering/shader_compiler.cpp index 119ac677eb..f52963f98f 100644 --- a/servers/rendering/shader_compiler.cpp +++ b/servers/rendering/shader_compiler.cpp @@ -489,7 +489,7 @@ String ShaderCompiler::_dump_node_code(const SL::Node *p_node, int p_level, Gene struct_code += _typestr(m->datatype); } struct_code += " "; - struct_code += m->name; + struct_code += _mkid(m->name); if (m->array_size > 0) { struct_code += "["; struct_code += itos(m->array_size); @@ -1448,7 +1448,13 @@ String ShaderCompiler::_dump_node_code(const SL::Node *p_node, int p_level, Gene } break; case SL::Node::NODE_TYPE_MEMBER: { SL::MemberNode *mnode = (SL::MemberNode *)p_node; - code = _dump_node_code(mnode->owner, p_level, r_gen_code, p_actions, p_default_actions, p_assigning) + "." + mnode->name; + String name; + if (mnode->basetype == SL::TYPE_STRUCT) { + name = _mkid(mnode->name); + } else { + name = mnode->name; + } + code = _dump_node_code(mnode->owner, p_level, r_gen_code, p_actions, p_default_actions, p_assigning) + "." + name; if (mnode->index_expression != nullptr) { code += "["; code += _dump_node_code(mnode->index_expression, p_level, r_gen_code, p_actions, p_default_actions, p_assigning); |