diff options
| author | Egor Yusov <egor.yusov@gmail.com> | 2018-06-16 22:49:31 +0000 |
|---|---|---|
| committer | Egor Yusov <egor.yusov@gmail.com> | 2018-06-16 22:49:31 +0000 |
| commit | 3ab4870f0826d91b00ccbeba8aa95189b779678b (patch) | |
| tree | cca97875f114901b833bf2f431f2c49b4a5d16aa /Graphics/GraphicsEngineVulkan | |
| parent | Reworked vulkan descriptor set binding to set dynamic buffer offsets at draw ... (diff) | |
| download | DiligentCore-3ab4870f0826d91b00ccbeba8aa95189b779678b.tar.gz DiligentCore-3ab4870f0826d91b00ccbeba8aa95189b779678b.zip | |
Improved dynamic heap memory usage stats reporting
Diffstat (limited to 'Graphics/GraphicsEngineVulkan')
| -rw-r--r-- | Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp | 28 | ||||
| -rw-r--r-- | Graphics/GraphicsEngineVulkan/src/VulkanDynamicHeap.cpp | 5 |
2 files changed, 28 insertions, 5 deletions
diff --git a/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp index 9062d962..39be6239 100644 --- a/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp +++ b/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp @@ -22,6 +22,7 @@ */ #include "pch.h" +#include <sstream> #include "RenderDeviceVkImpl.h" #include "DeviceContextVkImpl.h" #include "SwapChainVk.h" @@ -34,6 +35,29 @@ namespace Diligent { + static std::string GetUploadHeapName(bool bIsDeferred, Uint32 ContextId) + { + if(bIsDeferred) + { + std::stringstream ss; + ss << "Upload heap of deferred context #" << ContextId; + return ss.str(); + } + else + return "Upload heap of immediate context"; + } + + static std::string GetDynamicHeapName(bool bIsDeferred, Uint32 ContextId) + { + if (bIsDeferred) + { + std::stringstream ss; + ss << "Dynamic heap of deferred context #" << ContextId; + return ss.str(); + } + else + return "Dynamic heap of immediate context"; + } DeviceContextVkImpl::DeviceContextVkImpl( IReferenceCounters* pRefCounters, RenderDeviceVkImpl* pDeviceVkImpl, @@ -57,7 +81,7 @@ namespace Diligent // Upload heap must always be thread-safe as Finish() may be called from another thread m_UploadHeap { - bIsDeferred ? "Upload heap for deferred context" : "Upload heap for immediate context", + GetUploadHeapName(bIsDeferred, ContextId), pDeviceVkImpl->GetLogicalDevice(), pDeviceVkImpl->GetPhysicalDevice(), GetRawAllocator(), @@ -87,7 +111,7 @@ namespace Diligent m_DynamicHeap { pDeviceVkImpl->GetDynamicHeapRingBuffer(), - bIsDeferred ? "Dynamic heap for immediate context" : "Dynamic heap for deferred context", + GetDynamicHeapName(bIsDeferred, ContextId), bIsDeferred ? Attribs.DeferredCtxDynamicHeapPageSize : Attribs.ImmediateCtxDynamicHeapPageSize } { diff --git a/Graphics/GraphicsEngineVulkan/src/VulkanDynamicHeap.cpp b/Graphics/GraphicsEngineVulkan/src/VulkanDynamicHeap.cpp index a62368c6..80322bcd 100644 --- a/Graphics/GraphicsEngineVulkan/src/VulkanDynamicHeap.cpp +++ b/Graphics/GraphicsEngineVulkan/src/VulkanDynamicHeap.cpp @@ -114,7 +114,7 @@ VulkanRingBuffer::~VulkanRingBuffer() VERIFY(m_BufferMemory == VK_NULL_HANDLE && m_VkBuffer == VK_NULL_HANDLE, "Vulkan resources must be explcitly released with Destroy()"); LOG_INFO_MESSAGE("Dynamic heap ring buffer usage stats:\n" " Total size: ", SizeFormatter{ m_RingBuffer.GetMaxSize(), 2 }, - ". Peak buffer size: ", SizeFormatter{ m_TotalPeakSize, 2, m_RingBuffer.GetMaxSize() }, + ". Peak allocated size: ", SizeFormatter{ m_TotalPeakSize, 2, m_RingBuffer.GetMaxSize() }, ". Peak frame size: ", SizeFormatter{ m_FramePeakSize, 2, m_RingBuffer.GetMaxSize() }, ". Peak utilization: ", std::fixed, std::setprecision(1), static_cast<double>(m_TotalPeakSize) / static_cast<double>(std::max(m_RingBuffer.GetMaxSize(), size_t{1})) * 100.0, '%' ); } @@ -206,8 +206,7 @@ VulkanDynamicAllocation VulkanDynamicHeap::Allocate(Uint32 SizeInBytes, Uint32 A VulkanDynamicHeap::~VulkanDynamicHeap() { LOG_INFO_MESSAGE(m_HeapName, " usage stats:\n" - " Peak allocated size: ", SizeFormatter{ m_PeakAllocatedSize, 2, m_PeakAllocatedSize }, - ". Peak used size: ", SizeFormatter{ m_PeakUsedSize, 2, m_PeakAllocatedSize }, + " Peak used/peak allocated size: ", SizeFormatter{ m_PeakUsedSize, 2, m_PeakAllocatedSize }, '/', SizeFormatter{ m_PeakAllocatedSize, 2, m_PeakAllocatedSize }, ". Peak utilization: ", std::fixed, std::setprecision(1), static_cast<double>(m_PeakUsedSize) / static_cast<double>(std::max(m_PeakAllocatedSize, 1U)) * 100.0, '%'); } |
