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

Function define_struct

source/effect_codegen_hlsl.cpp:847–878  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

845 }
846
847 id define_struct(const location &loc, struct_type &info) override
848 {
849 const id res = info.id = make_id();
850 define_name<naming::unique>(res, info.unique_name);
851
852 _structs.push_back(info);
853
854 std::string &code = _blocks.at(_current_block);
855
856 write_location(code, loc);
857
858 code += "struct " + id_to_name(res) + "\n{\n";
859
860 for (const member_type &member : info.member_list)
861 {
862 code += '\t';
863 write_type<true>(code, member.type); // HLSL allows interpolation attributes on struct members, so handle this like a parameter
864 code += ' ' + member.name;
865
866 if (member.type.is_array())
867 code += '[' + std::to_string(member.type.array_length) + ']';
868
869 if (!member.semantic.empty())
870 code += " : " + convert_semantic(member.semantic, std::max(1u, member.type.components() / 4u) * std::max(1u, member.type.array_length));
871
872 code += ";\n";
873 }
874
875 code += "};\n";
876
877 return res;
878 }
879 id define_texture(const location &, texture &info) override
880 {
881 const id res = info.id = make_id();

Callers

nothing calls this directly

Calls 7

write_locationFunction · 0.85
id_to_nameFunction · 0.85
to_stringFunction · 0.85
convert_semanticFunction · 0.85
atMethod · 0.80
is_arrayMethod · 0.80
componentsMethod · 0.80

Tested by

no test coverage detected