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

Function on_unmap_texture

examples/08-texture_replace/texture_replace_addon.cpp:138–154  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

136 s_current_mapping.data = *data;
137}
138static void on_unmap_texture(device *, resource resource, uint32_t subresource)
139{
140 if (subresource != 0 || resource != s_current_mapping.res)
141 return;
142
143 s_current_mapping.res = { 0 };
144
145 void *mapped_data = s_current_mapping.data.data;
146
147 if (load_texture_image(s_current_mapping.desc, s_current_mapping.data, s_data_to_delete))
148 {
149 std::memcpy(mapped_data, s_current_mapping.data.data, s_current_mapping.data.slice_pitch);
150
151 // Free the memory allocated via the 'load_texture_image' call above
152 s_data_to_delete.clear();
153 }
154}
155
156extern "C" __declspec(dllexport) const char *NAME = "Texture Replace";
157extern "C" __declspec(dllexport) const char *DESCRIPTION = "Example add-on that replaces textures before they are used by the application with image files from disk (\"" RESHADE_ADDON_TEXTURE_LOAD_DIR "\" directory).";

Callers

nothing calls this directly

Calls 2

load_texture_imageFunction · 0.85
clearMethod · 0.45

Tested by

no test coverage detected