summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/VertexLoaderBase.cpp
diff options
context:
space:
mode:
authorPokechu22 <Pokechu022@gmail.com>2021-02-08 15:22:10 -0800
committerPokechu22 <Pokechu022@gmail.com>2021-03-06 19:27:08 -0800
commitf749fcfa9f42cda679ff7f4288c8418d2b56b08d (patch)
tree5bcc8c255eae974638c20f1a4e76a22fcaee69e4 /Source/Core/VideoCommon/VertexLoaderBase.cpp
parentc27efb3f1fefa49db7962532865fbbe483f248f1 (diff)
Convert CPMemory to BitField and enum class
Additionally, VCacheEnhance has been added to UVAT_group1. According to YAGCD, this field is always 1. TVtxDesc also now has separate low and high fields whose hex values correspond with the proper registers, instead of having one 33-bit value. This change was made in a way that should be backwards-compatible.
Diffstat (limited to 'Source/Core/VideoCommon/VertexLoaderBase.cpp')
-rw-r--r--Source/Core/VideoCommon/VertexLoaderBase.cpp66
1 files changed, 18 insertions, 48 deletions
diff --git a/Source/Core/VideoCommon/VertexLoaderBase.cpp b/Source/Core/VideoCommon/VertexLoaderBase.cpp
index c5baa503e6..483d46dd08 100644
--- a/Source/Core/VideoCommon/VertexLoaderBase.cpp
+++ b/Source/Core/VideoCommon/VertexLoaderBase.cpp
@@ -81,64 +81,33 @@ std::string VertexLoaderBase::ToString() const
dest += GetName();
dest += ": ";
- static constexpr std::array<const char*, 4> pos_mode{{
- "Inv",
- "Dir",
- "I8",
- "I16",
- }};
- static constexpr std::array<const char*, 8> pos_formats{{
- "u8",
- "s8",
- "u16",
- "s16",
- "flt",
- "Inv",
- "Inv",
- "Inv",
- }};
- static constexpr std::array<const char*, 8> color_format{{
- "565",
- "888",
- "888x",
- "4444",
- "6666",
- "8888",
- "Inv",
- "Inv",
- }};
-
- dest += fmt::format("{}b skin: {} P: {} {}-{} ", m_VertexSize, m_VtxDesc.PosMatIdx,
- m_VtxAttr.PosElements ? 3 : 2, pos_mode[m_VtxDesc.Position],
- pos_formats[m_VtxAttr.PosFormat]);
-
- if (m_VtxDesc.Normal)
+ 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, pos_mode[m_VtxDesc.Normal],
- pos_formats[m_VtxAttr.NormalFormat]);
+ dest += fmt::format("Nrm: {} {}-{} ", m_VtxAttr.NormalElements, m_VtxDesc.low.Normal,
+ m_VtxAttr.NormalFormat);
}
- const std::array<u64, 2> color_mode{{m_VtxDesc.Color0, m_VtxDesc.Color1}};
- for (size_t i = 0; i < color_mode.size(); i++)
+ for (size_t i = 0; i < g_main_cp_state.vtx_desc.low.Color.Size(); i++)
{
- if (color_mode[i] == 0)
+ 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, pos_mode[color_mode[i]],
- color_format[color.Comp]);
+ dest += fmt::format("C{}: {} {}-{} ", i, color.Elements, g_main_cp_state.vtx_desc.low.Color[i],
+ color.Comp);
}
- const std::array<u64, 8> tex_mode{{m_VtxDesc.Tex0Coord, m_VtxDesc.Tex1Coord, m_VtxDesc.Tex2Coord,
- m_VtxDesc.Tex3Coord, m_VtxDesc.Tex4Coord, m_VtxDesc.Tex5Coord,
- m_VtxDesc.Tex6Coord, m_VtxDesc.Tex7Coord}};
- for (size_t i = 0; i < tex_mode.size(); i++)
+
+ for (size_t i = 0; i < g_main_cp_state.vtx_desc.high.TexCoord.Size(); i++)
{
- if (tex_mode[i] == 0)
+ 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, pos_mode[tex_mode[i]],
- pos_formats[tex_coord.Format]);
+ 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;
@@ -200,8 +169,9 @@ public:
{
ERROR_LOG_FMT(VIDEO,
"The two vertex loaders have loaded different data "
- "(guru meditation {:#018x}, {:#010x}, {:#010x}, {:#010x}).",
- m_VtxDesc.Hex, m_vat.g0.Hex, m_vat.g1.Hex, m_vat.g2.Hex);
+ "(guru meditation {:#010x}, {:#010x}, {:#010x}, {:#010x}, {:#010x}).",
+ m_VtxDesc.low.Hex, m_VtxDesc.high.Hex, m_vat.g0.Hex, m_vat.g1.Hex,
+ m_vat.g2.Hex);
}
memcpy(dst.GetPointer(), buffer_a.data(), count_a * m_native_vtx_decl.stride);