Eliminate TVtxDesc.GetLegacyHex

This commit is contained in:
Pokechu22 2021-06-08 21:35:43 -07:00
parent 820d9ffbfa
commit 1500a0119b
5 changed files with 6 additions and 20 deletions

View File

@ -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,

View File

@ -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)

View File

@ -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<u32>(GetLegacyHex()); }
// Only *1* bit is used in this
u32 GetLegacyHex1() const { return static_cast<u32>(GetLegacyHex() >> 32); }
void SetLegacyHex(u64 value)
{
low.Hex = value & 0x1FFFF;
high.Hex = value >> 17;
}
};
template <>
struct fmt::formatter<TVtxDesc::Low>

View File

@ -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;

View File

@ -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));