diff options
| author | assiduous <assiduous@diligentgraphics.com> | 2021-01-10 22:46:13 +0000 |
|---|---|---|
| committer | assiduous <assiduous@diligentgraphics.com> | 2021-01-10 22:46:13 +0000 |
| commit | 18c0c9dea9ff73f1526473aacb85f9a6bb272b13 (patch) | |
| tree | 32e20e80f2ad8fb0f6798bfb6092e3239263674b /AssetLoader/interface | |
| parent | Minor fix in GLTF resource manager (diff) | |
| download | DiligentTools-18c0c9dea9ff73f1526473aacb85f9a6bb272b13.tar.gz DiligentTools-18c0c9dea9ff73f1526473aacb85f9a6bb272b13.zip | |
GLTF loader: reworked initial texture data to be stored as user data in the texture/allocation to make sure that GPU data is always initialized before the first use
Diffstat (limited to 'AssetLoader/interface')
| -rw-r--r-- | AssetLoader/interface/GLTFResourceManager.hpp | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/AssetLoader/interface/GLTFResourceManager.hpp b/AssetLoader/interface/GLTFResourceManager.hpp index 0e47137..a65f9e1 100644 --- a/AssetLoader/interface/GLTFResourceManager.hpp +++ b/AssetLoader/interface/GLTFResourceManager.hpp @@ -78,7 +78,8 @@ public: RefCntAutoPtr<ITextureAtlasSuballocation> AllocateTextureSpace(TEXTURE_FORMAT Fmt, Uint32 Width, Uint32 Height, - const char* CacheId = nullptr); + const char* CacheId = nullptr, + IObject* pUserData = nullptr); RefCntAutoPtr<ITextureAtlasSuballocation> FindAllocation(const char* CacheId); @@ -116,6 +117,23 @@ public: return cache_it->second->GetTexture(pDevice, pContext); } + // NB: can't return reference here! + TextureDesc GetAtlasDesc(TEXTURE_FORMAT Fmt) + { + { + std::lock_guard<std::mutex> Lock{m_AtlasesMtx}; + + auto cache_it = m_Atlases.find(Fmt); + if (cache_it != m_Atlases.end()) + return cache_it->second->GetAtlasDesc(); + } + + // Atlas is not present in the map - use default description + TextureDesc Desc = m_DefaultAtlasDesc.Desc; + Desc.Format = Fmt; + return Desc; + } + private: template <typename AllocatorType, typename ObjectType> friend class Diligent::MakeNewRCObj; |
