mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-11 05:26:24 +02:00
softjit: Throw away regs allocated in conditionals.
If this happens, the register no longer has a deterministic value.
This commit is contained in:
1 parent
5907897c36
commit
d35ef352c3
1 file changed
+18
@@ -676,6 +676,9 @@ bool PixelJitCache::Jit_StencilTest(const PixelFuncID &id, RegCache::Reg stencil
|
||||
return true;
|
||||
}
|
||||
|
||||
bool hadGStateReg = regCache_.Has(RegCache::GEN_GSTATE);
|
||||
bool hadColorOffReg = regCache_.Has(RegCache::GEN_COLOR_OFF);
|
||||
|
||||
bool success = true;
|
||||
if (stencilReg != INVALID_REG && (!hasFixedResult || !fixedResult)) {
|
||||
// This is the fail path.
|
||||
@@ -685,6 +688,12 @@ bool PixelJitCache::Jit_StencilTest(const PixelFuncID &id, RegCache::Reg stencil
|
||||
Discard();
|
||||
}
|
||||
|
||||
// If we allocated either gstate or colorOff in the conditional, forget.
|
||||
if (!hadGStateReg && regCache_.Has(RegCache::GEN_GSTATE))
|
||||
regCache_.Change(RegCache::GEN_GSTATE, RegCache::GEN_INVALID);
|
||||
if (!hadColorOffReg && regCache_.Has(RegCache::GEN_COLOR_OFF))
|
||||
regCache_.Change(RegCache::GEN_COLOR_OFF, RegCache::GEN_INVALID);
|
||||
|
||||
if (!hasFixedResult)
|
||||
SetJumpTarget(toPass);
|
||||
return success;
|
||||
@@ -741,11 +750,20 @@ bool PixelJitCache::Jit_DepthTestForStencil(const PixelFuncID &id, RegCache::Reg
|
||||
break;
|
||||
}
|
||||
|
||||
bool hadGStateReg = regCache_.Has(RegCache::GEN_GSTATE);
|
||||
bool hadColorOffReg = regCache_.Has(RegCache::GEN_COLOR_OFF);
|
||||
|
||||
bool success = true;
|
||||
success = success && Jit_ApplyStencilOp(id, id.ZFail(), stencilReg);
|
||||
success = success && Jit_WriteStencilOnly(id, stencilReg);
|
||||
Discard();
|
||||
|
||||
// If we allocated either gstate or colorOff in the conditional, forget.
|
||||
if (!hadGStateReg && regCache_.Has(RegCache::GEN_GSTATE))
|
||||
regCache_.Change(RegCache::GEN_GSTATE, RegCache::GEN_INVALID);
|
||||
if (!hadColorOffReg && regCache_.Has(RegCache::GEN_COLOR_OFF))
|
||||
regCache_.Change(RegCache::GEN_COLOR_OFF, RegCache::GEN_INVALID);
|
||||
|
||||
SetJumpTarget(skip);
|
||||
|
||||
// Like in Jit_DepthTest(), at this point we may not need this reg anymore.
|
||||
|
||||
Reference in new issue
Block a user