From 9ebd84e54afecee306b4bbc97fa15604def37310 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sun, 26 Mar 2017 22:52:10 -0400 Subject: [PATCH] VertexLoaderManager: Return debug strings by value This also renames AppendListToString to VertexLoadersToString. --- Source/Core/VideoCommon/Statistics.cpp | 3 +-- Source/Core/VideoCommon/VertexLoaderManager.cpp | 13 +++++++++---- Source/Core/VideoCommon/VertexLoaderManager.h | 2 +- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Source/Core/VideoCommon/Statistics.cpp b/Source/Core/VideoCommon/Statistics.cpp index 1497a3df30..0a4a9236b0 100644 --- a/Source/Core/VideoCommon/Statistics.cpp +++ b/Source/Core/VideoCommon/Statistics.cpp @@ -68,8 +68,7 @@ std::string Statistics::ToString() str += StringFromFormat("Uniform streamed: %i kB\n", stats.thisFrame.bytesUniformStreamed / 1024); str += StringFromFormat("Vertex Loaders: %i\n", stats.numVertexLoaders); - std::string vertex_list; - VertexLoaderManager::AppendListToString(&vertex_list); + std::string vertex_list = VertexLoaderManager::VertexLoadersToString(); // TODO : at some point text1 just becomes too huge and overflows, we can't even read the added // stuff diff --git a/Source/Core/VideoCommon/VertexLoaderManager.cpp b/Source/Core/VideoCommon/VertexLoaderManager.cpp index f0d8decb3d..463094e66b 100644 --- a/Source/Core/VideoCommon/VertexLoaderManager.cpp +++ b/Source/Core/VideoCommon/VertexLoaderManager.cpp @@ -98,7 +98,7 @@ struct entry }; } -void AppendListToString(std::string* dest) +std::string VertexLoadersToString() { std::lock_guard lk(s_vertex_loader_map_lock); std::vector entries; @@ -112,13 +112,18 @@ void AppendListToString(std::string* dest) total_size += e.text.size() + 1; entries.push_back(std::move(e)); } + sort(entries.begin(), entries.end()); - dest->reserve(dest->size() + total_size); + + std::string dest; + dest.reserve(total_size); for (const entry& entry : entries) { - *dest += entry.text; - *dest += '\n'; + dest += entry.text; + dest += '\n'; } + + return dest; } void MarkAllDirty() diff --git a/Source/Core/VideoCommon/VertexLoaderManager.h b/Source/Core/VideoCommon/VertexLoaderManager.h index bff6d4e8eb..30ceb41aec 100644 --- a/Source/Core/VideoCommon/VertexLoaderManager.h +++ b/Source/Core/VideoCommon/VertexLoaderManager.h @@ -30,7 +30,7 @@ NativeVertexFormatMap* GetNativeVertexFormatMap(); int RunVertices(int vtx_attr_group, int primitive, int count, DataReader src, bool is_preprocess); // For debugging -void AppendListToString(std::string* dest); +std::string VertexLoadersToString(); NativeVertexFormat* GetCurrentVertexFormat();