mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
samplerjit: Refactor nearest using reg cache.
This commit is contained in:
parent
676ed6c15d
commit
d7c25b3e7c
4 changed files with 533 additions and 245 deletions
|
@ -335,6 +335,28 @@ void RegCache::GrabReg(Reg r, Purpose p, bool &needsSwap, Reg swapReg, Purpose s
|
|||
_assert_msg_(false, "softjit GrabReg() reg that isn't there");
|
||||
}
|
||||
|
||||
bool RegCache::ChangeReg(Reg r, Purpose p) {
|
||||
for (auto ® : regs) {
|
||||
if (reg.reg != r)
|
||||
continue;
|
||||
if ((reg.purpose & FLAG_GEN) != (p & FLAG_GEN))
|
||||
continue;
|
||||
|
||||
if (reg.purpose == p)
|
||||
return true;
|
||||
_assert_msg_(!Has(p), "softjit ChangeReg() duplicate purpose (%04X)", p);
|
||||
|
||||
if (reg.locked != 0 || reg.forceRetained)
|
||||
return false;
|
||||
|
||||
reg.purpose = p;
|
||||
return true;
|
||||
}
|
||||
|
||||
_assert_msg_(false, "softjit ChangeReg() reg that isn't there");
|
||||
return false;
|
||||
}
|
||||
|
||||
RegCache::RegStatus *RegCache::FindReg(Reg r, Purpose p) {
|
||||
for (auto ® : regs) {
|
||||
if (reg.reg == r && reg.purpose == p) {
|
||||
|
|
|
@ -92,12 +92,23 @@ struct RegCache {
|
|||
GEN_STENCIL = 0x0103,
|
||||
GEN_COLOR_OFF = 0x0104,
|
||||
GEN_DEPTH_OFF = 0x0105,
|
||||
GEN_RESULT = 0x0106,
|
||||
GEN_SHIFTVAL = 0x0107,
|
||||
|
||||
GEN_ARG_X = 0x0180,
|
||||
GEN_ARG_Y = 0x0181,
|
||||
GEN_ARG_Z = 0x0182,
|
||||
GEN_ARG_FOG = 0x0183,
|
||||
GEN_ARG_ID = 0x0184,
|
||||
GEN_ARG_U = 0x0185,
|
||||
GEN_ARG_V = 0x0186,
|
||||
GEN_ARG_TEXPTR = 0x0187,
|
||||
GEN_ARG_BUFW = 0x0188,
|
||||
GEN_ARG_LEVEL = 0x0189,
|
||||
GEN_ARG_U_PTR = 0x018A,
|
||||
GEN_ARG_V_PTR = 0x018B,
|
||||
GEN_ARG_FRAC_U = 0x018C,
|
||||
GEN_ARG_FRAC_V = 0x018D,
|
||||
VEC_ARG_COLOR = 0x0080,
|
||||
VEC_ARG_MASK = 0x0081,
|
||||
|
||||
|
@ -170,6 +181,8 @@ struct RegCache {
|
|||
|
||||
// For getting a specific reg. WARNING: May return a locked reg, so you have to check.
|
||||
void GrabReg(Reg r, Purpose p, bool &needsSwap, Reg swapReg, Purpose swapPurpose);
|
||||
// For setting the purpose of a specific reg. Returns false if it is locked.
|
||||
bool ChangeReg(Reg r, Purpose p);
|
||||
|
||||
private:
|
||||
RegStatus *FindReg(Reg r, Purpose p);
|
||||
|
|
|
@ -84,6 +84,7 @@ private:
|
|||
|
||||
std::unordered_map<SamplerID, NearestFunc> cache_;
|
||||
std::unordered_map<SamplerID, const u8 *> addresses_;
|
||||
Rasterizer::RegCache regCache_;
|
||||
};
|
||||
|
||||
};
|
||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue