From f7fea57bb67f6ad2476f712503e9f4d5addc21cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Fri, 7 Jul 2017 15:12:57 +0200 Subject: [PATCH] More RIP addressing in software skinning.. --- Common/MemoryUtil.cpp | 2 ++ GPU/Common/VertexDecoderX86.cpp | 9 +++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Common/MemoryUtil.cpp b/Common/MemoryUtil.cpp index 3beb140ef9..c572ddacab 100644 --- a/Common/MemoryUtil.cpp +++ b/Common/MemoryUtil.cpp @@ -129,6 +129,7 @@ void *AllocateExecutableMemory(size_t size) { #if defined(_M_X64) if ((uintptr_t)&hint_location > 0xFFFFFFFFULL) { size_t aligned_size = round_page(size); +#if 1 // Turn off to hunt for RIP bugs on x86-64. ptr = SearchForFreeMem(aligned_size); if (!ptr) { // Let's try again, from the top. @@ -136,6 +137,7 @@ void *AllocateExecutableMemory(size_t size) { last_executable_addr = 0; ptr = SearchForFreeMem(aligned_size); } +#endif if (ptr) { ptr = VirtualAlloc(ptr, aligned_size, MEM_RESERVE | MEM_COMMIT, prot); } else { diff --git a/GPU/Common/VertexDecoderX86.cpp b/GPU/Common/VertexDecoderX86.cpp index 182c47c258..82b4c7e002 100644 --- a/GPU/Common/VertexDecoderX86.cpp +++ b/GPU/Common/VertexDecoderX86.cpp @@ -207,6 +207,7 @@ JittedVertexDecoder VertexDecoderJitCache::Compile(const VertexDecoder &dec, int MOV(PTRBITS, R(tempReg1), ImmPtr(&aOne)); MOVUPS(XMM5, MatR(tempReg1)); MOV(PTRBITS, R(tempReg1), ImmPtr(gstate.boneMatrix)); + MOV(PTRBITS, R(tempReg2), ImmPtr(bones)); for (int i = 0; i < dec.nweights; i++) { MOVUPS(XMM0, MDisp(tempReg1, (12 * i) * 4)); MOVUPS(XMM1, MDisp(tempReg1, (12 * i + 3) * 4)); @@ -217,10 +218,10 @@ JittedVertexDecoder VertexDecoderJitCache::Compile(const VertexDecoder &dec, int ANDPS(XMM2, R(XMM4)); ANDPS(XMM3, R(XMM4)); ORPS(XMM3, R(XMM5)); - MOVAPS(M((bones + 16 * i)), XMM0); - MOVAPS(M((bones + 16 * i + 4)), XMM1); - MOVAPS(M((bones + 16 * i + 8)), XMM2); - MOVAPS(M((bones + 16 * i + 12)), XMM3); + MOVAPS(MDisp(tempReg2, (16 * i) * 4), XMM0); + MOVAPS(MDisp(tempReg2, (16 * i + 4) * 4), XMM1); + MOVAPS(MDisp(tempReg2, (16 * i + 8) * 4), XMM2); + MOVAPS(MDisp(tempReg2, (16 * i + 12) * 4), XMM3); } }