More RIP addressing in software skinning..

This commit is contained in:
Henrik Rydgård 2017-07-07 15:12:57 +02:00
parent 837118d230
commit f7fea57bb6
2 changed files with 7 additions and 4 deletions

View File

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

View File

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