From 9ee5218761bd81c25c5281357bf44b09924fd879 Mon Sep 17 00:00:00 2001 From: baldurk Date: Wed, 13 Apr 2016 00:37:28 +0200 Subject: [PATCH] Add more file-size stats to statistics viewer --- renderdoc/api/replay/data_types.h | 3 +++ renderdoc/driver/d3d11/d3d11_device.cpp | 4 ++++ renderdoc/driver/gl/gl_driver.cpp | 4 ++++ renderdoc/driver/vulkan/vk_core.cpp | 4 ++++ renderdocui/Interop/FetchInfo.cs | 3 +++ renderdocui/Windows/StatisticsViewer.cs | 15 ++++++++++----- 6 files changed, 28 insertions(+), 5 deletions(-) diff --git a/renderdoc/api/replay/data_types.h b/renderdoc/api/replay/data_types.h index 62e55f753..7c42ea5bf 100644 --- a/renderdoc/api/replay/data_types.h +++ b/renderdoc/api/replay/data_types.h @@ -248,6 +248,9 @@ struct FetchFrameInfo uint32_t frameNumber; uint32_t firstEvent; uint64_t fileOffset; + uint64_t fileSize; + uint64_t persistentSize; + uint64_t initDataSize; uint64_t captureTime; ResourceId immContextId; FetchFrameStatistics stats; diff --git a/renderdoc/driver/d3d11/d3d11_device.cpp b/renderdoc/driver/d3d11/d3d11_device.cpp index 4a03a2d33..93a34cb73 100644 --- a/renderdoc/driver/d3d11/d3d11_device.cpp +++ b/renderdoc/driver/d3d11/d3d11_device.cpp @@ -1117,6 +1117,10 @@ void WrappedID3D11Device::ReadLogInitialisation() } #endif + m_FrameRecord.frameInfo.fileSize = m_pSerialiser->GetSize(); + m_FrameRecord.frameInfo.persistentSize = m_pSerialiser->GetSize() - frameOffset; + m_FrameRecord.frameInfo.initDataSize = chunkInfos[(D3D11ChunkType)INITIAL_CONTENTS].totalsize; + RDCDEBUG("Allocating %llu persistant bytes of memory for the log.", m_pSerialiser->GetSize() - frameOffset); m_pSerialiser->SetDebugText(false); diff --git a/renderdoc/driver/gl/gl_driver.cpp b/renderdoc/driver/gl/gl_driver.cpp index e6d8aead5..c7f76b701 100644 --- a/renderdoc/driver/gl/gl_driver.cpp +++ b/renderdoc/driver/gl/gl_driver.cpp @@ -3072,6 +3072,10 @@ void WrappedOpenGL::ReadLogInitialisation() ); } #endif + + m_FrameRecord.frameInfo.fileSize = m_pSerialiser->GetSize(); + m_FrameRecord.frameInfo.persistentSize = m_pSerialiser->GetSize() - frameOffset; + m_FrameRecord.frameInfo.initDataSize = chunkInfos[(GLChunkType)INITIAL_CONTENTS].totalsize; RDCDEBUG("Allocating %llu persistant bytes of memory for the log.", m_pSerialiser->GetSize() - frameOffset); diff --git a/renderdoc/driver/vulkan/vk_core.cpp b/renderdoc/driver/vulkan/vk_core.cpp index 816562b5d..dc0b10ca2 100644 --- a/renderdoc/driver/vulkan/vk_core.cpp +++ b/renderdoc/driver/vulkan/vk_core.cpp @@ -1229,6 +1229,10 @@ void WrappedVulkan::ReadLogInitialisation() ); } #endif + + m_FrameRecord.frameInfo.fileSize = m_pSerialiser->GetSize(); + m_FrameRecord.frameInfo.persistentSize = m_pSerialiser->GetSize() - firstFrame; + m_FrameRecord.frameInfo.initDataSize = chunkInfos[(VulkanChunkType)INITIAL_CONTENTS].totalsize; RDCDEBUG("Allocating %llu persistant bytes of memory for the log.", m_pSerialiser->GetSize() - firstFrame); diff --git a/renderdocui/Interop/FetchInfo.cs b/renderdocui/Interop/FetchInfo.cs index 4e9793bbe..df5ea6bda 100644 --- a/renderdocui/Interop/FetchInfo.cs +++ b/renderdocui/Interop/FetchInfo.cs @@ -395,6 +395,9 @@ namespace renderdoc public UInt32 frameNumber; public UInt32 firstEvent; public UInt64 fileOffset; + public UInt64 fileSize; + public UInt64 persistentSize; + public UInt64 initDataSize; public UInt64 captureTime; public ResourceId immContextId; [CustomMarshalAs(CustomUnmanagedType.CustomClass)] diff --git a/renderdocui/Windows/StatisticsViewer.cs b/renderdocui/Windows/StatisticsViewer.cs index a9a78d920..8182b43c6 100644 --- a/renderdocui/Windows/StatisticsViewer.cs +++ b/renderdocui/Windows/StatisticsViewer.cs @@ -622,8 +622,6 @@ namespace renderdocui.Windows } } - UInt64 persistentData = (UInt64)fileSize - firstDrawcall.events[0].fileOffset; - var lastDraw = m_Core.CurDrawcalls[m_Core.CurDrawcalls.Length - 1]; while (lastDraw.children != null && lastDraw.children.Length > 0) lastDraw = lastDraw.children[lastDraw.children.Length - 1]; @@ -726,9 +724,16 @@ namespace renderdocui.Windows largeTexW /= largeTexCount; largeTexH /= largeTexCount; - string header = String.Format("Stats for {0}.\n\nFile size: {1:N2}MB\nPersistent Data (approx): {2:N2}MB\n", - Path.GetFileName(m_Core.LogFileName), - (float)fileSize / (1024.0f * 1024.0f), (float)persistentData / (1024.0f * 1024.0f)); + UInt64 persistentData = frameInfo.persistentSize; + + float compressedMB = (float)fileSize / (1024.0f * 1024.0f); + float uncompressedMB = (float)frameInfo.fileSize / (1024.0f * 1024.0f); + float compressRatio = uncompressedMB / compressedMB; + float persistentMB = (float)frameInfo.persistentSize / (1024.0f * 1024.0f); + float initDataMB = (float)frameInfo.initDataSize / (1024.0f * 1024.0f); + + string header = String.Format("Stats for {0}.\n\nFile size: {1:N2}MB ({2:N2}MB uncompressed, compression ratio {3:N2}:1)\nPersistent Data (approx): {4:N2}MB, Frame-initial data (approx): {5:N2}MB\n", + Path.GetFileName(m_Core.LogFileName), compressedMB, uncompressedMB, compressRatio, persistentMB, initDataMB); string draws = String.Format("Draw calls: {0}\nDispatch calls: {1}\n", drawCount, dispatchCount); string calls = statsRecorded ? String.Format("API calls: {0}\n\tIndex/vertex bind calls: {1}\n\tConstant bind calls: {2}\n\tSampler bind calls: {3}\n\tResource bind calls: {4}\n\tResource update calls: {5}\n",