diff options
author | Alexis Payen de la Garanderie <alexis.payen@ubisoft.com> | 2020-04-27 09:54:16 +0300 |
---|---|---|
committer | Alexis Payen de la Garanderie <alexis.payen@ubisoft.com> | 2020-04-27 09:54:16 +0300 |
commit | 4edfe96739244b4b49a80a6df9fb7c0be28160ff (patch) | |
tree | 7523560e7ab8591861689637825be79c858d840e /spirv_cross.cpp | |
parent | 7ba0f8f087aa2880b731ff9eb66f665ebe43042d (diff) |
Fixed recursion in combined_decoration_for_member
Members in nested structs were not properly iterated on,
and as a result, flags like row major for matrices could be
not propagated properly.
Diffstat (limited to 'spirv_cross.cpp')
-rw-r--r-- | spirv_cross.cpp | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/spirv_cross.cpp b/spirv_cross.cpp index 6fd31c88..9b03ecfa 100644 --- a/spirv_cross.cpp +++ b/spirv_cross.cpp @@ -4204,19 +4204,22 @@ Bitset Compiler::combined_decoration_for_member(const SPIRType &type, uint32_t i if (type_meta) { - auto &memb = type_meta->members; - if (index >= memb.size()) + auto &members = type_meta->members; + if (index >= members.size()) return flags; - auto &dec = memb[index]; + auto &dec = members[index]; - // If our type is a struct, traverse all the members as well recursively. flags.merge_or(dec.decoration_flags); - for (uint32_t i = 0; i < type.member_types.size(); i++) + auto &member_type = get<SPIRType>(type.member_types[index]); + + // If our member type is a struct, traverse all the child members as well recursively. + auto &member_childs = member_type.member_types; + for (uint32_t i = 0; i < member_childs.size(); i++) { - auto &memb_type = get<SPIRType>(type.member_types[i]); - if (!memb_type.pointer) - flags.merge_or(combined_decoration_for_member(memb_type, i)); + auto &child_member_type = get<SPIRType>(member_childs[i]); + if (!child_member_type.pointer) + flags.merge_or(combined_decoration_for_member(member_type, i)); } } |