Permalink
Browse files

More RIP addressing in software skinning..

  • Loading branch information...
hrydgard committed Jul 7, 2017
1 parent 837118d commit f7fea57bb67f6ad2476f712503e9f4d5addc21cd
Showing with 7 additions and 4 deletions.
  1. +2 −0 Common/MemoryUtil.cpp
  2. +5 −4 GPU/Common/VertexDecoderX86.cpp
View
@@ -129,13 +129,15 @@ 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.
// When we deallocate, this doesn't change, so we eventually run out of space.
last_executable_addr = 0;
ptr = SearchForFreeMem(aligned_size);
}
#endif
if (ptr) {
ptr = VirtualAlloc(ptr, aligned_size, MEM_RESERVE | MEM_COMMIT, prot);
} else {
@@ -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);
}
}

0 comments on commit f7fea57

Please sign in to comment.