mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-27 07:20:49 +00:00
softjit: Fix PixelFuncID arg on non-Windows x64.
Oops, this is of course not put on the stack, it's in R8.
This commit is contained in:
parent
2d8fdd8cf4
commit
9653c33d9c
@ -89,7 +89,6 @@ SingleFunc PixelJitCache::CompileSingle(const PixelFuncID &id) {
|
|||||||
#else
|
#else
|
||||||
// Must save: RBX, RSP, RBP, R12-R15
|
// Must save: RBX, RSP, RBP, R12-R15
|
||||||
|
|
||||||
regCache_.Add(R8, RegCache::GEN_INVALID);
|
|
||||||
regCache_.Add(R9, RegCache::GEN_INVALID);
|
regCache_.Add(R9, RegCache::GEN_INVALID);
|
||||||
regCache_.Add(XMM4, RegCache::VEC_INVALID);
|
regCache_.Add(XMM4, RegCache::VEC_INVALID);
|
||||||
|
|
||||||
@ -98,9 +97,9 @@ SingleFunc PixelJitCache::CompileSingle(const PixelFuncID &id) {
|
|||||||
regCache_.Add(RDX, RegCache::GEN_ARG_Z);
|
regCache_.Add(RDX, RegCache::GEN_ARG_Z);
|
||||||
regCache_.Add(RCX, RegCache::GEN_ARG_FOG);
|
regCache_.Add(RCX, RegCache::GEN_ARG_FOG);
|
||||||
regCache_.Add(XMM0, RegCache::VEC_ARG_COLOR);
|
regCache_.Add(XMM0, RegCache::VEC_ARG_COLOR);
|
||||||
|
regCache_.Add(R8, RegCache::GEN_ARG_ID);
|
||||||
|
|
||||||
// Here we just have the return and padding to align RPB.
|
stackIDOffset_ = -1;
|
||||||
stackIDOffset_ = 16;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Initially, disallow spill for args (they get unlocked when no longer needed.)
|
// Initially, disallow spill for args (they get unlocked when no longer needed.)
|
||||||
@ -109,6 +108,8 @@ SingleFunc PixelJitCache::CompileSingle(const PixelFuncID &id) {
|
|||||||
regCache_.ForceRetain(RegCache::GEN_ARG_Z);
|
regCache_.ForceRetain(RegCache::GEN_ARG_Z);
|
||||||
regCache_.ForceRetain(RegCache::GEN_ARG_FOG);
|
regCache_.ForceRetain(RegCache::GEN_ARG_FOG);
|
||||||
regCache_.ForceRetain(RegCache::VEC_ARG_COLOR);
|
regCache_.ForceRetain(RegCache::VEC_ARG_COLOR);
|
||||||
|
if (regCache_.Has(RegCache::GEN_ARG_ID))
|
||||||
|
regCache_.ForceRetain(RegCache::GEN_ARG_ID);
|
||||||
|
|
||||||
BeginWrite();
|
BeginWrite();
|
||||||
const u8 *start = AlignCode16();
|
const u8 *start = AlignCode16();
|
||||||
@ -145,6 +146,8 @@ SingleFunc PixelJitCache::CompileSingle(const PixelFuncID &id) {
|
|||||||
}
|
}
|
||||||
discards_.clear();
|
discards_.clear();
|
||||||
|
|
||||||
|
if (regCache_.Has(RegCache::GEN_ARG_ID))
|
||||||
|
regCache_.ForceRelease(RegCache::GEN_ARG_ID);
|
||||||
regCache_.Reset(success);
|
regCache_.Reset(success);
|
||||||
|
|
||||||
if (!success) {
|
if (!success) {
|
||||||
@ -1412,8 +1415,15 @@ bool PixelJitCache::Jit_Dither(const PixelFuncID &id) {
|
|||||||
LEA(32, valueReg, MComplex(argXReg, valueReg, 8, offsetof(PixelFuncID, cached.ditherMatrix)));
|
LEA(32, valueReg, MComplex(argXReg, valueReg, 8, offsetof(PixelFuncID, cached.ditherMatrix)));
|
||||||
|
|
||||||
// Okay, now abuse argXReg to read the PixelFuncID pointer on the stack.
|
// Okay, now abuse argXReg to read the PixelFuncID pointer on the stack.
|
||||||
MOV(PTRBITS, R(argXReg), MDisp(RSP, stackIDOffset_));
|
if (regCache_.Has(RegCache::GEN_ARG_ID)) {
|
||||||
MOVSX(32, 16, valueReg, MRegSum(argXReg, valueReg));
|
X64Reg idReg = regCache_.Find(RegCache::GEN_ARG_ID);
|
||||||
|
MOVSX(32, 16, valueReg, MRegSum(idReg, valueReg));
|
||||||
|
regCache_.Unlock(idReg, RegCache::GEN_ARG_ID);
|
||||||
|
} else {
|
||||||
|
_assert_(stackIDOffset_ != -1);
|
||||||
|
MOV(PTRBITS, R(argXReg), MDisp(RSP, stackIDOffset_));
|
||||||
|
MOVSX(32, 16, valueReg, MRegSum(argXReg, valueReg));
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
if (argXReg != INVALID_REG) {
|
if (argXReg != INVALID_REG) {
|
||||||
regCache_.Unlock(argXReg, RegCache::GEN_ARG_X);
|
regCache_.Unlock(argXReg, RegCache::GEN_ARG_X);
|
||||||
@ -1597,8 +1607,15 @@ bool PixelJitCache::Jit_WriteColor(const PixelFuncID &id) {
|
|||||||
#else
|
#else
|
||||||
maskReg = regCache_.Alloc(RegCache::GEN_TEMP3);
|
maskReg = regCache_.Alloc(RegCache::GEN_TEMP3);
|
||||||
// Load the pre-converted and combined write mask.
|
// Load the pre-converted and combined write mask.
|
||||||
MOV(PTRBITS, R(maskReg), MDisp(RSP, stackIDOffset_));
|
if (regCache_.Has(RegCache::GEN_ARG_ID)) {
|
||||||
MOV(32, R(maskReg), MDisp(maskReg, offsetof(PixelFuncID, cached.colorWriteMask)));
|
X64Reg idReg = regCache_.Find(RegCache::GEN_ARG_ID);
|
||||||
|
MOV(32, R(maskReg), MDisp(idReg, offsetof(PixelFuncID, cached.colorWriteMask)));
|
||||||
|
regCache_.Unlock(idReg, RegCache::GEN_ARG_ID);
|
||||||
|
} else {
|
||||||
|
_assert_(stackIDOffset_ != -1);
|
||||||
|
MOV(PTRBITS, R(maskReg), MDisp(RSP, stackIDOffset_));
|
||||||
|
MOV(32, R(maskReg), MDisp(maskReg, offsetof(PixelFuncID, cached.colorWriteMask)));
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,6 +97,7 @@ struct RegCache {
|
|||||||
GEN_ARG_Y = 0x0181,
|
GEN_ARG_Y = 0x0181,
|
||||||
GEN_ARG_Z = 0x0182,
|
GEN_ARG_Z = 0x0182,
|
||||||
GEN_ARG_FOG = 0x0183,
|
GEN_ARG_FOG = 0x0183,
|
||||||
|
GEN_ARG_ID = 0x0184,
|
||||||
VEC_ARG_COLOR = 0x0080,
|
VEC_ARG_COLOR = 0x0080,
|
||||||
VEC_ARG_MASK = 0x0081,
|
VEC_ARG_MASK = 0x0081,
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user