mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-04-16 14:42:52 +00:00
VertexLoaderBase: Return debug strings by value
An out parameter for this sort of thing is a C++03 hold-over. This also renames AppendToString to ToString.
This commit is contained in:
parent
8033a72f0b
commit
9859533ab4
@ -72,12 +72,13 @@ void VertexLoaderBase::SetVAT(const VAT& vat)
|
|||||||
m_VtxAttr.texCoord[7].Frac = vat.g2.Tex7Frac;
|
m_VtxAttr.texCoord[7].Frac = vat.g2.Tex7Frac;
|
||||||
};
|
};
|
||||||
|
|
||||||
void VertexLoaderBase::AppendToString(std::string* dest) const
|
std::string VertexLoaderBase::ToString() const
|
||||||
{
|
{
|
||||||
dest->reserve(250);
|
std::string dest;
|
||||||
|
dest.reserve(250);
|
||||||
|
|
||||||
dest->append(GetName());
|
dest += GetName();
|
||||||
dest->append(": ");
|
dest += ": ";
|
||||||
|
|
||||||
static constexpr std::array<const char*, 4> pos_mode{{
|
static constexpr std::array<const char*, 4> pos_mode{{
|
||||||
"Inv", "Dir", "I8", "I16",
|
"Inv", "Dir", "I8", "I16",
|
||||||
@ -89,14 +90,14 @@ void VertexLoaderBase::AppendToString(std::string* dest) const
|
|||||||
"565", "888", "888x", "4444", "6666", "8888", "Inv", "Inv",
|
"565", "888", "888x", "4444", "6666", "8888", "Inv", "Inv",
|
||||||
}};
|
}};
|
||||||
|
|
||||||
dest->append(StringFromFormat("%ib skin: %i P: %i %s-%s ", m_VertexSize, (u32)m_VtxDesc.PosMatIdx,
|
dest += StringFromFormat("%ib skin: %i P: %i %s-%s ", m_VertexSize, (u32)m_VtxDesc.PosMatIdx,
|
||||||
m_VtxAttr.PosElements ? 3 : 2, pos_mode[m_VtxDesc.Position],
|
m_VtxAttr.PosElements ? 3 : 2, pos_mode[m_VtxDesc.Position],
|
||||||
pos_formats[m_VtxAttr.PosFormat]));
|
pos_formats[m_VtxAttr.PosFormat]);
|
||||||
|
|
||||||
if (m_VtxDesc.Normal)
|
if (m_VtxDesc.Normal)
|
||||||
{
|
{
|
||||||
dest->append(StringFromFormat("Nrm: %i %s-%s ", m_VtxAttr.NormalElements,
|
dest += StringFromFormat("Nrm: %i %s-%s ", m_VtxAttr.NormalElements, pos_mode[m_VtxDesc.Normal],
|
||||||
pos_mode[m_VtxDesc.Normal], pos_formats[m_VtxAttr.NormalFormat]));
|
pos_formats[m_VtxAttr.NormalFormat]);
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::array<u64, 2> color_mode{{m_VtxDesc.Color0, m_VtxDesc.Color1}};
|
const std::array<u64, 2> color_mode{{m_VtxDesc.Color0, m_VtxDesc.Color1}};
|
||||||
@ -104,8 +105,8 @@ void VertexLoaderBase::AppendToString(std::string* dest) const
|
|||||||
{
|
{
|
||||||
if (color_mode[i])
|
if (color_mode[i])
|
||||||
{
|
{
|
||||||
dest->append(StringFromFormat("C%zu: %i %s-%s ", i, m_VtxAttr.color[i].Elements,
|
dest += StringFromFormat("C%zu: %i %s-%s ", i, m_VtxAttr.color[i].Elements,
|
||||||
pos_mode[color_mode[i]], color_format[m_VtxAttr.color[i].Comp]));
|
pos_mode[color_mode[i]], color_format[m_VtxAttr.color[i].Comp]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const std::array<u64, 8> tex_mode{{m_VtxDesc.Tex0Coord, m_VtxDesc.Tex1Coord, m_VtxDesc.Tex2Coord,
|
const std::array<u64, 8> tex_mode{{m_VtxDesc.Tex0Coord, m_VtxDesc.Tex1Coord, m_VtxDesc.Tex2Coord,
|
||||||
@ -115,12 +116,12 @@ void VertexLoaderBase::AppendToString(std::string* dest) const
|
|||||||
{
|
{
|
||||||
if (tex_mode[i])
|
if (tex_mode[i])
|
||||||
{
|
{
|
||||||
dest->append(StringFromFormat("T%zu: %i %s-%s ", i, m_VtxAttr.texCoord[i].Elements,
|
dest += StringFromFormat("T%zu: %i %s-%s ", i, m_VtxAttr.texCoord[i].Elements,
|
||||||
pos_mode[tex_mode[i]],
|
pos_mode[tex_mode[i]], pos_formats[m_VtxAttr.texCoord[i].Format]);
|
||||||
pos_formats[m_VtxAttr.texCoord[i].Format]));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dest->append(StringFromFormat(" - %i v", m_numLoadedVertices));
|
dest += StringFromFormat(" - %i v", m_numLoadedVertices);
|
||||||
|
return dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
// a hacky implementation to compare two vertex loaders
|
// a hacky implementation to compare two vertex loaders
|
||||||
|
@ -67,7 +67,7 @@ public:
|
|||||||
virtual bool IsInitialized() = 0;
|
virtual bool IsInitialized() = 0;
|
||||||
|
|
||||||
// For debugging / profiling
|
// For debugging / profiling
|
||||||
void AppendToString(std::string* dest) const;
|
std::string ToString() const;
|
||||||
|
|
||||||
virtual std::string GetName() const = 0;
|
virtual std::string GetName() const = 0;
|
||||||
|
|
||||||
|
@ -106,11 +106,11 @@ void AppendListToString(std::string* dest)
|
|||||||
size_t total_size = 0;
|
size_t total_size = 0;
|
||||||
for (const auto& map_entry : s_vertex_loader_map)
|
for (const auto& map_entry : s_vertex_loader_map)
|
||||||
{
|
{
|
||||||
entry e;
|
entry e = {map_entry.second->ToString(),
|
||||||
map_entry.second->AppendToString(&e.text);
|
static_cast<u64>(map_entry.second->m_numLoadedVertices)};
|
||||||
e.num_verts = map_entry.second->m_numLoadedVertices;
|
|
||||||
entries.push_back(e);
|
|
||||||
total_size += e.text.size() + 1;
|
total_size += e.text.size() + 1;
|
||||||
|
entries.push_back(std::move(e));
|
||||||
}
|
}
|
||||||
sort(entries.begin(), entries.end());
|
sort(entries.begin(), entries.end());
|
||||||
dest->reserve(dest->size() + total_size);
|
dest->reserve(dest->size() + total_size);
|
||||||
|
@ -51,8 +51,7 @@ VertexLoaderX64::VertexLoaderX64(const TVtxDesc& vtx_desc, const VAT& vtx_att)
|
|||||||
GenerateVertexLoader();
|
GenerateVertexLoader();
|
||||||
WriteProtect();
|
WriteProtect();
|
||||||
|
|
||||||
std::string name;
|
const std::string name = ToString();
|
||||||
AppendToString(&name);
|
|
||||||
JitRegister::Register(region, GetCodePtr(), name.c_str());
|
JitRegister::Register(region, GetCodePtr(), name.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user