summaryrefslogtreecommitdiffstats
path: root/AssetLoader/src/GLTFResourceManager.cpp
diff options
context:
space:
mode:
authorassiduous <assiduous@diligentgraphics.com>2020-12-12 05:59:21 +0000
committerassiduous <assiduous@diligentgraphics.com>2020-12-12 05:59:21 +0000
commit1526355589b6cb29df4d1d18bf7554a5f1f251d6 (patch)
treefa8aa18077a7a89ee34887aff5fc3839c507338c /AssetLoader/src/GLTFResourceManager.cpp
parentGLTFLoader: added option to not load animation data and skin (diff)
downloadDiligentTools-1526355589b6cb29df4d1d18bf7554a5f1f251d6.tar.gz
DiligentTools-1526355589b6cb29df4d1d18bf7554a5f1f251d6.zip
GLTF resource manager: fixed issue with allocation cache not being protected by mutex
Diffstat (limited to 'AssetLoader/src/GLTFResourceManager.cpp')
-rw-r--r--AssetLoader/src/GLTFResourceManager.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/AssetLoader/src/GLTFResourceManager.cpp b/AssetLoader/src/GLTFResourceManager.cpp
index 54c3416..f3b8b8b 100644
--- a/AssetLoader/src/GLTFResourceManager.cpp
+++ b/AssetLoader/src/GLTFResourceManager.cpp
@@ -126,8 +126,10 @@ RefCntAutoPtr<ITextureAtlasSuballocation> ResourceManager::AllocateTextureSpace(
if (CacheId != nullptr && *CacheId != 0)
{
- auto inserted = m_TexAllocations.emplace(CacheId, pAllocation).second;
- VERIFY_EXPR(inserted);
+ std::lock_guard<std::mutex> Lock{m_TexAllocationsMtx};
+ // Note that the same allocation may potentially be created by more
+ // than one thread if it has not been found in the cache originally
+ m_TexAllocations.emplace(CacheId, pAllocation).second;
}
return pAllocation;