static void UpdateResources(string page) { string group = "Resources count"; MyStatsDisplay.Write(group, "Array textures", MyManagers.ArrayTextures.GetArrayTexturesCount(), page); MyStatsDisplay.Write(group, "DepthStencils", MyManagers.DepthStencils.GetDepthStencilsCount(), page); MyStatsDisplay.Write(group, "Custom textures", MyManagers.CustomTextures.GetTexturesCount(), page); MyStatsDisplay.Write(group, "Blend states", MyManagers.BlendStates.GetResourcesCount(), page); MyStatsDisplay.Write(group, "Depth stencil states", MyManagers.DepthStencilStates.GetResourcesCount(), page); MyStatsDisplay.Write(group, "Rasterizer states", MyManagers.RasterizerStates.GetResourcesCount(), page); MyStatsDisplay.Write(group, "Sampler states", MyManagers.SamplerStates.GetResourcesCount(), page); MyStatsDisplay.Write(group, "Deferred RCs", MyDeferredRenderContextManager.MaxDeferredRCsCount, page); group = "Hardware Buffers"; foreach (var bufferStatistic in MyManagers.Buffers.GetReport()) { MyStatsDisplay.Write(group, bufferStatistic.Name + " TotalBuffers", bufferStatistic.TotalBuffers, page); MyStatsDisplay.Write(group, bufferStatistic.Name + " TotalBytes", bufferStatistic.TotalBytes, page); MyStatsDisplay.Write(group, bufferStatistic.Name + " TotalBuffersPeak", bufferStatistic.TotalBuffersPeak, page); MyStatsDisplay.Write(group, bufferStatistic.Name + " TotalBytesPeak", bufferStatistic.TotalBytesPeak, page); } group = "File Textures"; MyFileTextureUsageReport report = MyManagers.FileTextures.GetReport(); MyStatsDisplay.Write(group, "Total", report.TexturesTotal, page); MyStatsDisplay.Write(group, "Loaded", report.TexturesLoaded, page); MyStatsDisplay.Write(group, "Memory KB", (int)(report.TotalTextureMemory / 1024), page); MyStatsDisplay.Write(group, "Total (peak)", report.TexturesTotalPeak, page); MyStatsDisplay.Write(group, "Loaded (peak)", report.TexturesLoadedPeak, page); MyStatsDisplay.Write(group, "Memory (peak) KB", (int)(report.TotalTextureMemoryPeak / 1024), page); group = "Texture Arrays"; MyTextureStatistics statistics = MyManagers.FileArrayTextures.Statistics; MyStatsDisplay.Write(group, "Total", statistics.TexturesTotal, page); MyStatsDisplay.Write(group, "Memory KB", (int)(statistics.TotalTextureMemory / 1024), page); MyStatsDisplay.Write(group, "Total (peak)", statistics.TexturesTotalPeak, page); MyStatsDisplay.Write(group, "Memory (peak) KB", (int)(statistics.TotalTextureMemoryPeak / 1024), page); group = "RW Textures"; statistics = MyManagers.RwTextures.Statistics; MyStatsDisplay.Write(group, "Total", statistics.TexturesTotal, page); MyStatsDisplay.Write(group, "Memory KB", (int)(statistics.TotalTextureMemory / 1024), page); MyStatsDisplay.Write(group, "Total (peak)", statistics.TexturesTotalPeak, page); MyStatsDisplay.Write(group, "Memory (peak) KB", (int)(statistics.TotalTextureMemoryPeak / 1024), page); group = "Generated Textures"; statistics = MyManagers.GeneratedTextures.Statistics; MyStatsDisplay.Write(group, "Total", statistics.TexturesTotal, page); MyStatsDisplay.Write(group, "Memory KB", (int)(statistics.TotalTextureMemory / 1024), page); MyStatsDisplay.Write(group, "Total (peak)", statistics.TexturesTotalPeak, page); MyStatsDisplay.Write(group, "Memory (peak) KB", (int)(statistics.TotalTextureMemoryPeak / 1024), page); }
public static void Draw(Dictionary <MyRenderStats.ColumnEnum, List <MyStats> > m_stats, float scale, Color color) { foreach (var pair in m_stats) { try { foreach (var s in pair.Value) { s.WriteTo(m_tmpDrawText); m_tmpDrawText.AppendLine(); // Newline between each group } Vector2 pos = new Vector2(10, 10); if (pair.Key == MyRenderStats.ColumnEnum.Right) { Vector2 size = MyRender11.GetDebugFont().MeasureString(m_tmpDrawText, scale); if (m_rightColumnWidth < size.X) { m_rightColumnWidth = size.X * m_rightGapSizeRatio; // Add some gap m_rightColumnChangeTime = MyRender11.CurrentDrawTime; } else if (m_rightColumnWidth > size.X * m_rightGapSizeRatio && (MyRender11.CurrentDrawTime - m_rightColumnChangeTime).Seconds > 3) { m_rightColumnWidth = size.X * m_rightGapSizeRatio; m_rightColumnChangeTime = MyRender11.CurrentDrawTime; } pos = new Vector2(MyRender11.ViewportResolution.X - m_rightColumnWidth, 0); } /* Add info about render buffers */ m_tmpDrawText.Append("Hardware Buffers (count/bytes):\n"); foreach (var bufferStatistic in MyManagers.Buffers.GetReport()) { m_tmpDrawText.AppendFormat(" {0}: {1:N0}/{2:N0}\n", bufferStatistic.Name, bufferStatistic.TotalBuffers, bufferStatistic.TotalBytes); } m_tmpDrawText.Append("Textures:\n"); MyFileTextureUsageReport report = MyManagers.FileTextures.GetReport(); m_tmpDrawText.AppendFormat(" Total: {0}\n", report.TexturesTotal); m_tmpDrawText.AppendFormat(" Loaded: {0}\n", report.TexturesLoaded); m_tmpDrawText.AppendFormat(" Memory: {0:N0}\n", report.TotalTextureMemory); MyDebugTextHelpers.DrawText(pos, m_tmpDrawText, color, scale); } finally { m_tmpDrawText.Clear(); } } }