MCPcopy Create free account
hub / github.com/crosire/reshade / define_struct

Method define_struct

source/effect_codegen_glsl.cpp:782–812  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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();

Callers 1

parse_structMethod · 0.45

Calls 7

write_locationFunction · 0.85
id_to_nameFunction · 0.85
write_typeFunction · 0.85
escape_nameFunction · 0.85
to_stringFunction · 0.85
atMethod · 0.80
is_arrayMethod · 0.80

Tested by

no test coverage detected