summaryrefslogtreecommitdiffstats
path: root/AssetLoader/src/GLTFResourceManager.cpp
diff options
context:
space:
mode:
authorassiduous <assiduous@diligentgraphics.com>2020-12-10 05:17:25 +0000
committerassiduous <assiduous@diligentgraphics.com>2020-12-10 05:17:25 +0000
commitf9f8a42f2b1265345f6d3b2d40fb23a744fa6a30 (patch)
tree1114e7da2819adc56c95eaa7282a1de7d0efd9d9 /AssetLoader/src/GLTFResourceManager.cpp
parentReworked GLTF resource manager to use BufferSuballocator and DynamicTextureAtlas (diff)
downloadDiligentTools-f9f8a42f2b1265345f6d3b2d40fb23a744fa6a30.tar.gz
DiligentTools-f9f8a42f2b1265345f6d3b2d40fb23a744fa6a30.zip
GLTFLoader: made sure that texture files are not loaded when found in the cache
Diffstat (limited to 'AssetLoader/src/GLTFResourceManager.cpp')
-rw-r--r--AssetLoader/src/GLTFResourceManager.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/AssetLoader/src/GLTFResourceManager.cpp b/AssetLoader/src/GLTFResourceManager.cpp
index a30e265..54c3416 100644
--- a/AssetLoader/src/GLTFResourceManager.cpp
+++ b/AssetLoader/src/GLTFResourceManager.cpp
@@ -69,14 +69,17 @@ RefCntAutoPtr<ITextureAtlasSuballocation> ResourceManager::FindAllocation(const
{
RefCntAutoPtr<ITextureAtlasSuballocation> pAllocation;
- std::lock_guard<std::mutex> Lock{m_TexAllocationsMtx};
-
- auto it = m_TexAllocations.find(CacheId);
- if (it != m_TexAllocations.end())
+ if (CacheId != nullptr && *CacheId != 0)
{
- pAllocation = it->second.Lock();
- if (!pAllocation)
- m_TexAllocations.erase(it);
+ std::lock_guard<std::mutex> Lock{m_TexAllocationsMtx};
+
+ auto it = m_TexAllocations.find(CacheId);
+ if (it != m_TexAllocations.end())
+ {
+ pAllocation = it->second.Lock();
+ if (!pAllocation)
+ m_TexAllocations.erase(it);
+ }
}
return pAllocation;