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

Function define_storage

source/effect_codegen_hlsl.cpp:993–1017  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

991 return res;
992 }
993 id define_storage(const location &loc, const texture &tex_info, storage &info) override
994 {
995 const id res = info.id = create_block();
996 define_name<naming::unique>(res, info.unique_name);
997
998 // Default to a register index equivalent to the entry in the storage list (this is later overwritten in 'finalize_code_for_entry_point' to a more optimal placement)
999 const uint32_t default_binding = static_cast<uint32_t>(_module.storages.size());
1000
1001 if (_shader_model >= 50)
1002 {
1003 std::string &code = _blocks.at(res);
1004
1005 write_location(code, loc);
1006
1007 if (_shader_model >= 60)
1008 code += "[[vk::binding(" + std::to_string(default_binding) + ", 3)]] "; // Descriptor set 3
1009
1010 write_type(code, info.type, tex_info.format);
1011 code += ' ' + info.unique_name + " : register(u" + std::to_string(default_binding) + ");\n";
1012 }
1013
1014 _module.storages.push_back(info);
1015
1016 return res;
1017 }
1018 id define_uniform(const location &loc, uniform &info) override
1019 {
1020 const id res = make_id();

Callers

nothing calls this directly

Calls 5

write_locationFunction · 0.85
to_stringFunction · 0.85
write_typeFunction · 0.85
atMethod · 0.80
create_blockFunction · 0.70

Tested by

no test coverage detected