MCPcopy Create free account
hub / github.com/Norbyte/bg3se / DecTextureRef

Method DecTextureRef

BG3Extender/Extender/Client/IMGUI/IMGUI.cpp:2249–2268  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2247
2248
2249bool IMGUITextureLoader::DecTextureRef(TextureOpaqueHandle id, FixedString const& textureGuid)
2250{
2251 if (!renderer_) {
2252 ERR("Unloading texture with no rendering backend?");
2253 return false;
2254 }
2255
2256 auto refs = refCounts_.try_get(textureGuid);
2257 if (!refs) {
2258 ERR("Trying to release reference to texture '%s' but it has no references?", textureGuid.GetString());
2259 return false;
2260 }
2261
2262 if (--refs->RefCount == 0) {
2263 refCounts_.remove(textureGuid);
2264 pendingUnloads_.set(textureGuid, TextureUnloadRequest{ id, DeleteAfterFrames });
2265 }
2266
2267 return true;
2268}
2269
2270std::optional<TextureLoadResult> IMGUIManager::RegisterTexture(FixedString const& textureGuid)
2271{

Callers 1

UnregisterTextureMethod · 0.80

Calls 4

GetStringMethod · 0.80
try_getMethod · 0.45
removeMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected