From 1500a0119bbb9086b0482a94b154612a0684f194 Mon Sep 17 00:00:00 2001 From: Pokechu22 Date: Tue, 8 Jun 2021 21:35:43 -0700 Subject: [PATCH] Eliminate TVtxDesc.GetLegacyHex --- Source/Core/Core/State.cpp | 2 +- Source/Core/VideoCommon/CPMemory.cpp | 4 +--- Source/Core/VideoCommon/CPMemory.h | 13 ------------- Source/Core/VideoCommon/VertexLoaderBase.h | 4 ++-- Source/UnitTests/VideoCommon/VertexLoaderTest.cpp | 3 ++- 5 files changed, 6 insertions(+), 20 deletions(-) diff --git a/Source/Core/Core/State.cpp b/Source/Core/Core/State.cpp index 2ab2146c06..d84c6cbb84 100644 --- a/Source/Core/Core/State.cpp +++ b/Source/Core/Core/State.cpp @@ -74,7 +74,7 @@ static Common::Event g_compressAndDumpStateSyncEvent; static std::thread g_save_thread; // Don't forget to increase this after doing changes on the savestate system -constexpr u32 STATE_VERSION = 131; // Last changed in PR 9773 +constexpr u32 STATE_VERSION = 132; // Last changed in PR 9532 // Maps savestate versions to Dolphin versions. // Versions after 42 don't need to be added to this list, diff --git a/Source/Core/VideoCommon/CPMemory.cpp b/Source/Core/VideoCommon/CPMemory.cpp index eb59869368..87f3375b31 100644 --- a/Source/Core/VideoCommon/CPMemory.cpp +++ b/Source/Core/VideoCommon/CPMemory.cpp @@ -17,9 +17,7 @@ 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); - u64 vtx_desc = g_main_cp_state.vtx_desc.GetLegacyHex(); - p.Do(vtx_desc); - g_main_cp_state.vtx_desc.SetLegacyHex(vtx_desc); + p.Do(g_main_cp_state.vtx_desc); p.DoArray(g_main_cp_state.vtx_attr); p.DoMarker("CP Memory"); if (p.mode == PointerWrap::MODE_READ) diff --git a/Source/Core/VideoCommon/CPMemory.h b/Source/Core/VideoCommon/CPMemory.h index 488d210129..ae240254e3 100644 --- a/Source/Core/VideoCommon/CPMemory.h +++ b/Source/Core/VideoCommon/CPMemory.h @@ -229,19 +229,6 @@ struct TVtxDesc Low low; High high; - - // This structure was originally packed into bits 0..32, using 33 total bits. - // The actual format has 17 bits in the low one and 16 bits in the high one, - // but the old format is still supported for compatibility. - u64 GetLegacyHex() const { return (low.Hex & 0x1FFFF) | (u64(high.Hex) << 17); } - u32 GetLegacyHex0() const { return static_cast(GetLegacyHex()); } - // Only *1* bit is used in this - u32 GetLegacyHex1() const { return static_cast(GetLegacyHex() >> 32); } - void SetLegacyHex(u64 value) - { - low.Hex = value & 0x1FFFF; - high.Hex = value >> 17; - } }; template <> struct fmt::formatter diff --git a/Source/Core/VideoCommon/VertexLoaderBase.h b/Source/Core/VideoCommon/VertexLoaderBase.h index 9b030e1f2b..06babc9d4a 100644 --- a/Source/Core/VideoCommon/VertexLoaderBase.h +++ b/Source/Core/VideoCommon/VertexLoaderBase.h @@ -24,8 +24,8 @@ public: VertexLoaderUID() {} VertexLoaderUID(const TVtxDesc& vtx_desc, const VAT& vat) { - vid[0] = vtx_desc.GetLegacyHex0(); - vid[1] = vtx_desc.GetLegacyHex1(); + vid[0] = vtx_desc.low.Hex; + vid[1] = vtx_desc.high.Hex; vid[2] = vat.g0.Hex; vid[3] = vat.g1.Hex; vid[4] = vat.g2.Hex; diff --git a/Source/UnitTests/VideoCommon/VertexLoaderTest.cpp b/Source/UnitTests/VideoCommon/VertexLoaderTest.cpp index 925a13114a..93656a9d23 100644 --- a/Source/UnitTests/VideoCommon/VertexLoaderTest.cpp +++ b/Source/UnitTests/VideoCommon/VertexLoaderTest.cpp @@ -29,7 +29,8 @@ TEST(VertexLoaderUID, UniqueEnough) memset(&vat, 0, sizeof(vat)); uids.insert(VertexLoaderUID(vtx_desc, vat)); - vtx_desc.SetLegacyHex(0xFEDCBA9876543210ull); + vtx_desc.low.Hex = 0x76543210; + vtx_desc.high.Hex = 0xFEDCBA98; EXPECT_EQ(uids.end(), uids.find(VertexLoaderUID(vtx_desc, vat))); uids.insert(VertexLoaderUID(vtx_desc, vat));