From f749fcfa9f42cda679ff7f4288c8418d2b56b08d Mon Sep 17 00:00:00 2001 From: Pokechu22 Date: Mon, 8 Feb 2021 15:22:10 -0800 Subject: 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. --- Source/Core/VideoCommon/VertexLoaderBase.cpp | 66 ++++++++-------------------- 1 file changed, 18 insertions(+), 48 deletions(-) (limited to 'Source/Core/VideoCommon/VertexLoaderBase.cpp') 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 pos_mode{{ - "Inv", - "Dir", - "I8", - "I16", - }}; - static constexpr std::array pos_formats{{ - "u8", - "s8", - "u16", - "s16", - "flt", - "Inv", - "Inv", - "Inv", - }}; - static constexpr std::array 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 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 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); -- cgit v1.2.3