Remove VertexLoader::ToString

This commit is contained in:
Pokechu22 2021-03-10 18:48:26 -08:00
parent bc7da726a5
commit b6149623aa
9 changed files with 12 additions and 81 deletions

View File

@ -524,6 +524,16 @@ struct VAT
UVAT_group1 g1;
UVAT_group2 g2;
};
template <>
struct fmt::formatter<VAT>
{
constexpr auto parse(format_parse_context& ctx) { return ctx.begin(); }
template <typename FormatContext>
auto format(const VAT& vat, FormatContext& ctx)
{
return format_to(ctx.out(), "{}\n{}\n{}", vat.g0, vat.g1, vat.g2);
}
};
class VertexLoaderBase;

View File

@ -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;

View File

@ -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;

View File

@ -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:

View File

@ -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{};

View File

@ -114,34 +114,6 @@ struct entry
};
} // namespace
std::string VertexLoadersToString()
{
std::lock_guard<std::mutex> lk(s_vertex_loader_map_lock);
std::vector<entry> entries;
size_t total_size = 0;
for (const auto& map_entry : s_vertex_loader_map)
{
entry e = {map_entry.second->ToString(),
static_cast<u64>(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);

View File

@ -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.

View File

@ -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());
}

View File

@ -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;