Remove VertexLoader::ToString
This commit is contained in:
parent
bc7da726a5
commit
b6149623aa
|
@ -524,6 +524,16 @@ struct VAT
|
||||||
UVAT_group1 g1;
|
UVAT_group1 g1;
|
||||||
UVAT_group2 g2;
|
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;
|
class VertexLoaderBase;
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,6 @@ public:
|
||||||
VertexLoader(const TVtxDesc& vtx_desc, const VAT& vtx_attr);
|
VertexLoader(const TVtxDesc& vtx_desc, const VAT& vtx_attr);
|
||||||
|
|
||||||
int RunVertices(DataReader src, DataReader dst, int count) override;
|
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
|
bool IsInitialized() override { return true; } // This vertex loader supports all formats
|
||||||
// They are used for the communication with the loader functions
|
// They are used for the communication with the loader functions
|
||||||
float m_posScale;
|
float m_posScale;
|
||||||
|
|
|
@ -19,7 +19,6 @@ public:
|
||||||
VertexLoaderARM64(const TVtxDesc& vtx_desc, const VAT& vtx_att);
|
VertexLoaderARM64(const TVtxDesc& vtx_desc, const VAT& vtx_att);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::string GetName() const override { return "VertexLoaderARM64"; }
|
|
||||||
bool IsInitialized() override { return true; }
|
bool IsInitialized() override { return true; }
|
||||||
int RunVertices(DataReader src, DataReader dst, int count) override;
|
int RunVertices(DataReader src, DataReader dst, int count) override;
|
||||||
|
|
||||||
|
|
|
@ -73,46 +73,6 @@ void VertexLoaderBase::SetVAT(const VAT& vat)
|
||||||
m_VtxAttr.texCoord[7].Frac = vat.g2.Tex7Frac;
|
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
|
// a hacky implementation to compare two vertex loaders
|
||||||
class VertexLoaderTester : public VertexLoaderBase
|
class VertexLoaderTester : public VertexLoaderBase
|
||||||
{
|
{
|
||||||
|
@ -178,7 +138,6 @@ public:
|
||||||
m_numLoadedVertices += count;
|
m_numLoadedVertices += count;
|
||||||
return count_a;
|
return count_a;
|
||||||
}
|
}
|
||||||
std::string GetName() const override { return "CompareLoader"; }
|
|
||||||
bool IsInitialized() override { return m_initialized; }
|
bool IsInitialized() override { return m_initialized; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -67,11 +67,6 @@ public:
|
||||||
|
|
||||||
virtual bool IsInitialized() = 0;
|
virtual bool IsInitialized() = 0;
|
||||||
|
|
||||||
// For debugging / profiling
|
|
||||||
std::string ToString() const;
|
|
||||||
|
|
||||||
virtual std::string GetName() const = 0;
|
|
||||||
|
|
||||||
// per loader public state
|
// per loader public state
|
||||||
int m_VertexSize = 0; // number of bytes of a raw GC vertex
|
int m_VertexSize = 0; // number of bytes of a raw GC vertex
|
||||||
PortableVertexDeclaration m_native_vtx_decl{};
|
PortableVertexDeclaration m_native_vtx_decl{};
|
||||||
|
|
|
@ -114,34 +114,6 @@ struct entry
|
||||||
};
|
};
|
||||||
} // namespace
|
} // 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()
|
void MarkAllDirty()
|
||||||
{
|
{
|
||||||
g_main_cp_state.attr_dirty = BitSet32::AllTrue(8);
|
g_main_cp_state.attr_dirty = BitSet32::AllTrue(8);
|
||||||
|
|
|
@ -38,9 +38,6 @@ NativeVertexFormat* GetUberVertexFormat(const PortableVertexDeclaration& decl);
|
||||||
// Returns -1 if buf_size is insufficient, else the amount of bytes consumed
|
// 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);
|
int RunVertices(int vtx_attr_group, int primitive, int count, DataReader src, bool is_preprocess);
|
||||||
|
|
||||||
// For debugging
|
|
||||||
std::string VertexLoadersToString();
|
|
||||||
|
|
||||||
NativeVertexFormat* GetCurrentVertexFormat();
|
NativeVertexFormat* GetCurrentVertexFormat();
|
||||||
|
|
||||||
// Resolved pointers to array bases. Used by vertex loaders.
|
// Resolved pointers to array bases. Used by vertex loaders.
|
||||||
|
|
|
@ -53,7 +53,8 @@ VertexLoaderX64::VertexLoaderX64(const TVtxDesc& vtx_desc, const VAT& vtx_att)
|
||||||
GenerateVertexLoader();
|
GenerateVertexLoader();
|
||||||
WriteProtect();
|
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());
|
JitRegister::Register(region, GetCodePtr(), name.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,6 @@ public:
|
||||||
VertexLoaderX64(const TVtxDesc& vtx_desc, const VAT& vtx_att);
|
VertexLoaderX64(const TVtxDesc& vtx_desc, const VAT& vtx_att);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::string GetName() const override { return "VertexLoaderX64"; }
|
|
||||||
bool IsInitialized() override { return true; }
|
bool IsInitialized() override { return true; }
|
||||||
int RunVertices(DataReader src, DataReader dst, int count) override;
|
int RunVertices(DataReader src, DataReader dst, int count) override;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue