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/CPMemory.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'Source/Core/VideoCommon/CPMemory.cpp') diff --git a/Source/Core/VideoCommon/CPMemory.cpp b/Source/Core/VideoCommon/CPMemory.cpp index 52384cddaf..b4d118bbb4 100644 --- a/Source/Core/VideoCommon/CPMemory.cpp +++ b/Source/Core/VideoCommon/CPMemory.cpp @@ -17,7 +17,9 @@ void DoCPState(PointerWrap& p) p.DoArray(g_main_cp_state.array_strides); p.Do(g_main_cp_state.matrix_index_a); p.Do(g_main_cp_state.matrix_index_b); - p.Do(g_main_cp_state.vtx_desc.Hex); + u64 vtx_desc = g_main_cp_state.vtx_desc.GetLegacyHex(); + p.Do(vtx_desc); + g_main_cp_state.vtx_desc.SetLegacyHex(vtx_desc); p.DoArray(g_main_cp_state.vtx_attr); p.DoMarker("CP Memory"); if (p.mode == PointerWrap::MODE_READ) -- cgit v1.2.3 From 953e09428fac6384038c80b7337a71dbb8c00fbb Mon Sep 17 00:00:00 2001 From: Pokechu22 Date: Mon, 8 Feb 2021 15:22:48 -0800 Subject: Add names and descriptions for CP registers to the FIFO analyzer --- Source/Core/VideoCommon/CPMemory.cpp | 41 ++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'Source/Core/VideoCommon/CPMemory.cpp') diff --git a/Source/Core/VideoCommon/CPMemory.cpp b/Source/Core/VideoCommon/CPMemory.cpp index b4d118bbb4..eb59869368 100644 --- a/Source/Core/VideoCommon/CPMemory.cpp +++ b/Source/Core/VideoCommon/CPMemory.cpp @@ -33,3 +33,44 @@ void CopyPreprocessCPStateFromMain() { memcpy(&g_preprocess_cp_state, &g_main_cp_state, sizeof(CPState)); } + +std::pair GetCPRegInfo(u8 cmd, u32 value) +{ + switch (cmd & CP_COMMAND_MASK) + { + case MATINDEX_A: + return std::make_pair("MATINDEX_A", fmt::to_string(TMatrixIndexA{.Hex = value})); + case MATINDEX_B: + return std::make_pair("MATINDEX_B", fmt::to_string(TMatrixIndexB{.Hex = value})); + case VCD_LO: + return std::make_pair("VCD_LO", fmt::to_string(TVtxDesc::Low{.Hex = value})); + case VCD_HI: + return std::make_pair("VCD_HI", fmt::to_string(TVtxDesc::High{.Hex = value})); + case CP_VAT_REG_A: + if (cmd - CP_VAT_REG_A >= CP_NUM_VAT_REG) + return std::make_pair("CP_VAT_REG_A invalid", ""); + + return std::make_pair(fmt::format("CP_VAT_REG_A - Format {}", cmd & CP_VAT_MASK), + fmt::to_string(UVAT_group0{.Hex = value})); + case CP_VAT_REG_B: + if (cmd - CP_VAT_REG_B >= CP_NUM_VAT_REG) + return std::make_pair("CP_VAT_REG_B invalid", ""); + + return std::make_pair(fmt::format("CP_VAT_REG_B - Format {}", cmd & CP_VAT_MASK), + fmt::to_string(UVAT_group1{.Hex = value})); + case CP_VAT_REG_C: + if (cmd - CP_VAT_REG_C >= CP_NUM_VAT_REG) + return std::make_pair("CP_VAT_REG_C invalid", ""); + + return std::make_pair(fmt::format("CP_VAT_REG_C - Format {}", cmd & CP_VAT_MASK), + fmt::to_string(UVAT_group2{.Hex = value})); + case ARRAY_BASE: + return std::make_pair(fmt::format("ARRAY_BASE Array {}", cmd & CP_ARRAY_MASK), + fmt::format("Base address {:08x}", value)); + case ARRAY_STRIDE: + return std::make_pair(fmt::format("ARRAY_STRIDE Array {}", cmd - ARRAY_STRIDE), + fmt::format("Stride {:02x}", value & 0xff)); + default: + return std::make_pair(fmt::format("Invalid CP register {:02x} = {:08x}", cmd, value), ""); + } +} -- cgit v1.2.3