Skip to content

Commit

Permalink
Hydrogent: added texture atlas usage stats
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMostDiligent committed Nov 21, 2023
1 parent 9bfd914 commit de19e55
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
17 changes: 17 additions & 0 deletions Hydrogent/interface/HnRenderDelegate.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,23 @@ struct HnRenderDelegateMemoryStats
};
/// Vertex pool usage statistics.
VertexPoolUsage VertexPool;

/// Texture atlas usage statistics.
struct TextureAtlasUsage
{
/// The total committed memory size, in bytes.
Uint64 CommittedSize = 0;

/// The number of allcations.
Uint32 AllocationCount = 0;

/// The total number of texels in the atlas.
Uint64 TotalTexels = 0;

/// The total number of texels in all allocations.
Uint64 AllocatedTexels = 0;
};
TextureAtlasUsage Atlas;
};

/// USD render delegate implementation in Hydrogent.
Expand Down
10 changes: 8 additions & 2 deletions Hydrogent/src/HnRenderDelegate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -389,8 +389,9 @@ HnRenderDelegateMemoryStats HnRenderDelegate::GetMemoryStats() const
{
HnRenderDelegateMemoryStats MemoryStats;

const BufferSuballocatorUsageStats IndexUsage = m_ResourceMgr->GetIndexBufferUsageStats();
const VertexPoolUsageStats VertexUsage = m_ResourceMgr->GetVertexPoolUsageStats();
const BufferSuballocatorUsageStats IndexUsage = m_ResourceMgr->GetIndexBufferUsageStats();
const VertexPoolUsageStats VertexUsage = m_ResourceMgr->GetVertexPoolUsageStats();
const DynamicTextureAtlasUsageStats AtlasUsage = m_ResourceMgr->GetAtlasUsageStats();

MemoryStats.IndexPool.CommittedSize = IndexUsage.CommittedSize;
MemoryStats.IndexPool.UsedSize = IndexUsage.UsedSize;
Expand All @@ -401,6 +402,11 @@ HnRenderDelegateMemoryStats HnRenderDelegate::GetMemoryStats() const
MemoryStats.VertexPool.AllocationCount = VertexUsage.AllocationCount;
MemoryStats.VertexPool.AllocatedVertexCount = VertexUsage.AllocatedVertexCount;

MemoryStats.Atlas.CommittedSize = AtlasUsage.CommittedSize;
MemoryStats.Atlas.AllocationCount = AtlasUsage.AllocationCount;
MemoryStats.Atlas.TotalTexels = AtlasUsage.TotalArea;
MemoryStats.Atlas.AllocatedTexels = AtlasUsage.AllocatedArea;

return MemoryStats;
}

Expand Down

0 comments on commit de19e55

Please sign in to comment.