| 780 | } |
| 781 | |
| 782 | id define_struct(const location &loc, struct_type &info) override |
| 783 | { |
| 784 | const id res = info.id = make_id(); |
| 785 | define_name<naming::unique>(res, info.unique_name); |
| 786 | |
| 787 | _structs.push_back(info); |
| 788 | |
| 789 | std::string &code = _blocks.at(_current_block); |
| 790 | |
| 791 | write_location(code, loc); |
| 792 | |
| 793 | code += "struct " + id_to_name(res) + "\n{\n"; |
| 794 | |
| 795 | for (const member_type &member : info.member_list) |
| 796 | { |
| 797 | code += '\t'; |
| 798 | write_type(code, member.type); // GLSL does not allow interpolation attributes on struct members |
| 799 | code += ' '; |
| 800 | code += escape_name(member.name); |
| 801 | if (member.type.is_array()) |
| 802 | code += '[' + std::to_string(member.type.array_length) + ']'; |
| 803 | code += ";\n"; |
| 804 | } |
| 805 | |
| 806 | if (info.member_list.empty()) |
| 807 | code += "float _dummy;\n"; |
| 808 | |
| 809 | code += "};\n"; |
| 810 | |
| 811 | return res; |
| 812 | } |
| 813 | id define_texture(const location &, texture &info) override |
| 814 | { |
| 815 | const id res = info.id = make_id(); |
no test coverage detected