diff --git a/Source/Core/VideoCommon/CPMemory.h b/Source/Core/VideoCommon/CPMemory.h index f54445940f..5c50d30a85 100644 --- a/Source/Core/VideoCommon/CPMemory.h +++ b/Source/Core/VideoCommon/CPMemory.h @@ -524,6 +524,16 @@ struct VAT UVAT_group1 g1; UVAT_group2 g2; }; +template <> +struct fmt::formatter +{ + constexpr auto parse(format_parse_context& ctx) { return ctx.begin(); } + template + auto format(const VAT& vat, FormatContext& ctx) + { + return format_to(ctx.out(), "{}\n{}\n{}", vat.g0, vat.g1, vat.g2); + } +}; class VertexLoaderBase; diff --git a/Source/Core/VideoCommon/VertexLoader.h b/Source/Core/VideoCommon/VertexLoader.h index 2caae086d3..73738c86b8 100644 --- a/Source/Core/VideoCommon/VertexLoader.h +++ b/Source/Core/VideoCommon/VertexLoader.h @@ -22,7 +22,6 @@ public: VertexLoader(const TVtxDesc& vtx_desc, const VAT& vtx_attr); int RunVertices(DataReader src, DataReader dst, int count) override; - std::string GetName() const override { return "OldLoader"; } bool IsInitialized() override { return true; } // This vertex loader supports all formats // They are used for the communication with the loader functions float m_posScale; diff --git a/Source/Core/VideoCommon/VertexLoaderARM64.h b/Source/Core/VideoCommon/VertexLoaderARM64.h index b7faec0239..6b18b59c0e 100644 --- a/Source/Core/VideoCommon/VertexLoaderARM64.h +++ b/Source/Core/VideoCommon/VertexLoaderARM64.h @@ -19,7 +19,6 @@ public: VertexLoaderARM64(const TVtxDesc& vtx_desc, const VAT& vtx_att); protected: - std::string GetName() const override { return "VertexLoaderARM64"; } bool IsInitialized() override { return true; } int RunVertices(DataReader src, DataReader dst, int count) override; diff --git a/Source/Core/VideoCommon/VertexLoaderBase.cpp b/Source/Core/VideoCommon/VertexLoaderBase.cpp index 483d46dd08..604ad1f04b 100644 --- a/Source/Core/VideoCommon/VertexLoaderBase.cpp +++ b/Source/Core/VideoCommon/VertexLoaderBase.cpp @@ -73,46 +73,6 @@ void VertexLoaderBase::SetVAT(const VAT& vat) m_VtxAttr.texCoord[7].Frac = vat.g2.Tex7Frac; }; -std::string VertexLoaderBase::ToString() const -{ - std::string dest; - dest.reserve(250); - - dest += GetName(); - dest += ": "; - - dest += fmt::format("{}b skin: {} P: {} {}-{} ", m_VertexSize, m_VtxDesc.low.PosMatIdx, - m_VtxAttr.PosElements, m_VtxDesc.low.Position, m_VtxAttr.PosFormat); - - if (m_VtxDesc.low.Normal != VertexComponentFormat::NotPresent) - { - dest += fmt::format("Nrm: {} {}-{} ", m_VtxAttr.NormalElements, m_VtxDesc.low.Normal, - m_VtxAttr.NormalFormat); - } - - for (size_t i = 0; i < g_main_cp_state.vtx_desc.low.Color.Size(); i++) - { - if (g_main_cp_state.vtx_desc.low.Color[i] == VertexComponentFormat::NotPresent) - continue; - - const auto& color = m_VtxAttr.color[i]; - dest += fmt::format("C{}: {} {}-{} ", i, color.Elements, g_main_cp_state.vtx_desc.low.Color[i], - color.Comp); - } - - for (size_t i = 0; i < g_main_cp_state.vtx_desc.high.TexCoord.Size(); i++) - { - if (g_main_cp_state.vtx_desc.high.TexCoord[i] == VertexComponentFormat::NotPresent) - continue; - - const auto& tex_coord = m_VtxAttr.texCoord[i]; - dest += fmt::format("T{}: {} {}-{} ", i, tex_coord.Elements, - g_main_cp_state.vtx_desc.high.TexCoord[i], tex_coord.Format); - } - dest += fmt::format(" - {} v", m_numLoadedVertices); - return dest; -} - // a hacky implementation to compare two vertex loaders class VertexLoaderTester : public VertexLoaderBase { @@ -178,7 +138,6 @@ public: m_numLoadedVertices += count; return count_a; } - std::string GetName() const override { return "CompareLoader"; } bool IsInitialized() override { return m_initialized; } private: diff --git a/Source/Core/VideoCommon/VertexLoaderBase.h b/Source/Core/VideoCommon/VertexLoaderBase.h index 77b66f629b..cf100fb4c6 100644 --- a/Source/Core/VideoCommon/VertexLoaderBase.h +++ b/Source/Core/VideoCommon/VertexLoaderBase.h @@ -67,11 +67,6 @@ public: virtual bool IsInitialized() = 0; - // For debugging / profiling - std::string ToString() const; - - virtual std::string GetName() const = 0; - // per loader public state int m_VertexSize = 0; // number of bytes of a raw GC vertex PortableVertexDeclaration m_native_vtx_decl{}; diff --git a/Source/Core/VideoCommon/VertexLoaderManager.cpp b/Source/Core/VideoCommon/VertexLoaderManager.cpp index 94a331a0d2..ab362fc29c 100644 --- a/Source/Core/VideoCommon/VertexLoaderManager.cpp +++ b/Source/Core/VideoCommon/VertexLoaderManager.cpp @@ -114,34 +114,6 @@ struct entry }; } // namespace -std::string VertexLoadersToString() -{ - std::lock_guard lk(s_vertex_loader_map_lock); - std::vector entries; - - size_t total_size = 0; - for (const auto& map_entry : s_vertex_loader_map) - { - entry e = {map_entry.second->ToString(), - static_cast(map_entry.second->m_numLoadedVertices)}; - - total_size += e.text.size() + 1; - entries.push_back(std::move(e)); - } - - sort(entries.begin(), entries.end()); - - std::string dest; - dest.reserve(total_size); - for (const entry& entry : entries) - { - dest += entry.text; - dest += '\n'; - } - - return dest; -} - void MarkAllDirty() { g_main_cp_state.attr_dirty = BitSet32::AllTrue(8); diff --git a/Source/Core/VideoCommon/VertexLoaderManager.h b/Source/Core/VideoCommon/VertexLoaderManager.h index 71188cca6b..74856a4d28 100644 --- a/Source/Core/VideoCommon/VertexLoaderManager.h +++ b/Source/Core/VideoCommon/VertexLoaderManager.h @@ -38,9 +38,6 @@ NativeVertexFormat* GetUberVertexFormat(const PortableVertexDeclaration& decl); // Returns -1 if buf_size is insufficient, else the amount of bytes consumed int RunVertices(int vtx_attr_group, int primitive, int count, DataReader src, bool is_preprocess); -// For debugging -std::string VertexLoadersToString(); - NativeVertexFormat* GetCurrentVertexFormat(); // Resolved pointers to array bases. Used by vertex loaders. diff --git a/Source/Core/VideoCommon/VertexLoaderX64.cpp b/Source/Core/VideoCommon/VertexLoaderX64.cpp index 2c0a97b54b..27ccad71b5 100644 --- a/Source/Core/VideoCommon/VertexLoaderX64.cpp +++ b/Source/Core/VideoCommon/VertexLoaderX64.cpp @@ -53,7 +53,8 @@ VertexLoaderX64::VertexLoaderX64(const TVtxDesc& vtx_desc, const VAT& vtx_att) GenerateVertexLoader(); WriteProtect(); - const std::string name = ToString(); + const std::string name = + fmt::format("VertexLoaderX64\nVtx desc: \n{}\nVAT:\n{}", vtx_desc, vtx_att); JitRegister::Register(region, GetCodePtr(), name.c_str()); } diff --git a/Source/Core/VideoCommon/VertexLoaderX64.h b/Source/Core/VideoCommon/VertexLoaderX64.h index 0344d7f1c9..4b3029066c 100644 --- a/Source/Core/VideoCommon/VertexLoaderX64.h +++ b/Source/Core/VideoCommon/VertexLoaderX64.h @@ -18,7 +18,6 @@ public: VertexLoaderX64(const TVtxDesc& vtx_desc, const VAT& vtx_att); protected: - std::string GetName() const override { return "VertexLoaderX64"; } bool IsInitialized() override { return true; } int RunVertices(DataReader src, DataReader dst, int count) override;