Skip to content

Commit c5f8453

Browse files
GLTF Resource Manager: added GetAllocatedAtlasFormats function
1 parent 169a569 commit c5f8453

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

AssetLoader/interface/GLTFResourceManager.hpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019-2023 Diligent Graphics LLC
2+
* Copyright 2019-2024 Diligent Graphics LLC
33
* Copyright 2015-2019 Egor Yusov
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -314,6 +314,9 @@ class ResourceManager final : public ObjectBase<IObject>
314314
/// \remarks This function is thread-safe.
315315
void TransitionResourceStates(IRenderDevice* pDevice, IDeviceContext* pContext, const TransitionResourceStatesInfo& Info);
316316

317+
/// Returns the formats of the allocated texture atlases.
318+
std::vector<TEXTURE_FORMAT> GetAllocatedAtlasFormats() const;
319+
317320
private:
318321
template <typename AllocatorType, typename ObjectType>
319322
friend class Diligent::MakeNewRCObj;

AssetLoader/src/GLTFResourceManager.cpp

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019-2023 Diligent Graphics LLC
2+
* Copyright 2019-2024 Diligent Graphics LLC
33
* Copyright 2015-2019 Egor Yusov
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -26,6 +26,9 @@
2626
*/
2727

2828
#include "GLTFResourceManager.hpp"
29+
30+
#include <algorithm>
31+
2932
#include "DefaultRawMemoryAllocator.hpp"
3033
#include "Align.hpp"
3134
#include "GraphicsAccessories.hpp"
@@ -451,6 +454,21 @@ DynamicTextureAtlasUsageStats ResourceManager::GetAtlasUsageStats(TEXTURE_FORMAT
451454
return Stats;
452455
}
453456

457+
std::vector<TEXTURE_FORMAT> ResourceManager::GetAllocatedAtlasFormats() const
458+
{
459+
std::vector<TEXTURE_FORMAT> Formats;
460+
461+
{
462+
std::lock_guard<std::mutex> Guard{m_AtlasesMtx};
463+
Formats.reserve(m_Atlases.size());
464+
for (auto it : m_Atlases)
465+
Formats.push_back(it.first);
466+
}
467+
std::sort(Formats.begin(), Formats.end());
468+
469+
return Formats;
470+
}
471+
454472
VertexPoolUsageStats ResourceManager::GetVertexPoolUsageStats(const VertexLayoutKey& Key)
455473
{
456474
VertexPoolUsageStats Stats;

0 commit comments

Comments
 (0)