From 9a24bcdd9ff4dbed7b7b4b0678d82dd768b56e63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sat, 30 Jan 2021 18:40:18 +0100 Subject: [PATCH] Vertex cache minihash: Round up the starting address to a multiple of 4. --- GPU/Common/DrawEngineCommon.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/GPU/Common/DrawEngineCommon.cpp b/GPU/Common/DrawEngineCommon.cpp index 1784813175..807d2c322f 100644 --- a/GPU/Common/DrawEngineCommon.cpp +++ b/GPU/Common/DrawEngineCommon.cpp @@ -599,8 +599,9 @@ void DrawEngineCommon::DecodeVertsStep(u8 *dest, int &i, int &decodedVerts) { } inline u32 ComputeMiniHashRange(const void *ptr, size_t sz) { - // Switch to u32 units. - const u32 *p = (const u32 *)ptr; + // Switch to u32 units, and round up to avoid unaligned accesses. + // Probably doesn't matter if we skip the first few bytes in some cases. + const u32 *p = (const u32 *)(((uintptr_t)ptr + 3) & ~3); sz >>= 2; if (sz > 100) {