mirror of https://github.com/PCSX2/pcsx2.git
newVif: fixed some minor stuff...
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2382 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
171dc422be
commit
916cc034ff
|
@ -35,6 +35,7 @@ static __pagealigned u8 nVifUpkExec[__pagesize*4];
|
||||||
static __aligned16 nVifCall nVifUpk[(2*2*16) *4]; // ([USN][Masking][Unpack Type]) [curCycle]
|
static __aligned16 nVifCall nVifUpk[(2*2*16) *4]; // ([USN][Masking][Unpack Type]) [curCycle]
|
||||||
static __aligned16 u32 nVifMask[3][4][4] = {0}; // [MaskNumber][CycleNumber][Vector]
|
static __aligned16 u32 nVifMask[3][4][4] = {0}; // [MaskNumber][CycleNumber][Vector]
|
||||||
|
|
||||||
|
#define VUFT VIFUnpackFuncTable
|
||||||
#define _1mb (0x100000)
|
#define _1mb (0x100000)
|
||||||
#define _v0 0
|
#define _v0 0
|
||||||
#define _v1 0x55
|
#define _v1 0x55
|
||||||
|
@ -113,23 +114,28 @@ static const u32 nVifT[32] = {
|
||||||
2, // V4-5
|
2, // V4-5
|
||||||
|
|
||||||
// Second verse, same as the first!
|
// Second verse, same as the first!
|
||||||
|
4,2,1,0,8,4,2,0,12,6,3,0,16,8,4,2
|
||||||
|
};
|
||||||
|
|
||||||
4, // S-32
|
template< int idx, bool doMode, bool isFill, bool singleUnpack >
|
||||||
2, // S-16
|
__releaseinline void __fastcall _nVifUnpackLoop(u8 *data, u32 size);
|
||||||
1, // S-8
|
|
||||||
0, // ----
|
typedef void (__fastcall* Fnptr_VifUnpackLoop)(u8 *data, u32 size);
|
||||||
8, // V2-32
|
|
||||||
4, // V2-16
|
// Unpacks Until 'Num' is 0
|
||||||
2, // V2-8
|
static const __aligned16 Fnptr_VifUnpackLoop UnpackLoopTable[2][2][2] = {
|
||||||
0, // ----
|
{{ _nVifUnpackLoop<0,0,0,0>, _nVifUnpackLoop<0,0,1,0> },
|
||||||
12,// V3-32
|
{ _nVifUnpackLoop<0,1,0,0>, _nVifUnpackLoop<0,1,1,0> },},
|
||||||
6, // V3-16
|
{{ _nVifUnpackLoop<1,0,0,0>, _nVifUnpackLoop<1,0,1,0> },
|
||||||
3, // V3-8
|
{ _nVifUnpackLoop<1,1,0,0>, _nVifUnpackLoop<1,1,1,0> },},
|
||||||
0, // ----
|
};
|
||||||
16,// V4-32
|
|
||||||
8, // V4-16
|
// Unpacks until 1 normal write cycle unpack has been written to VU mem
|
||||||
4, // V4-8
|
static const __aligned16 Fnptr_VifUnpackLoop UnpackSingleTable[2][2][2] = {
|
||||||
2, // V4-5
|
{{ _nVifUnpackLoop<0,0,0,1>, _nVifUnpackLoop<0,0,1,1> },
|
||||||
|
{ _nVifUnpackLoop<0,1,0,1>, _nVifUnpackLoop<0,1,1,1> },},
|
||||||
|
{{ _nVifUnpackLoop<1,0,0,1>, _nVifUnpackLoop<1,0,1,1> },
|
||||||
|
{ _nVifUnpackLoop<1,1,0,1>, _nVifUnpackLoop<1,1,1,1> },},
|
||||||
};
|
};
|
||||||
|
|
||||||
#define useOldUnpack 0 // Use code in newVif_OldUnpack.inl
|
#define useOldUnpack 0 // Use code in newVif_OldUnpack.inl
|
||||||
|
|
|
@ -35,8 +35,9 @@ void dVifInit(int idx) {
|
||||||
|
|
||||||
_f void dVifRecLimit(int idx) {
|
_f void dVifRecLimit(int idx) {
|
||||||
if (nVif[idx].recPtr > nVif[idx].recEnd) {
|
if (nVif[idx].recPtr > nVif[idx].recEnd) {
|
||||||
nVif[idx].vifBlocks->clear();
|
|
||||||
DevCon.WriteLn("nVif Rec - Out of Rec Cache! [%x > %x]", nVif[idx].recPtr, nVif[idx].recEnd);
|
DevCon.WriteLn("nVif Rec - Out of Rec Cache! [%x > %x]", nVif[idx].recPtr, nVif[idx].recEnd);
|
||||||
|
nVif[idx].vifBlocks->clear();
|
||||||
|
nVif[idx].recPtr = nVif[idx].vifCache->getBlock();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -78,18 +78,15 @@ int nVifUnpack(int idx, u8* data) {
|
||||||
vif->tag.size -= ret;
|
vif->tag.size -= ret;
|
||||||
|
|
||||||
if (v.partTransfer) { // Last transfer was a partial vector transfer...
|
if (v.partTransfer) { // Last transfer was a partial vector transfer...
|
||||||
const u8* vuMemBase = (idx ? VU1 : VU0).Mem;
|
const bool doMode = vifRegs->mode && !(vif->tag.cmd & 0x10);
|
||||||
const u8* dest = setVUptr(idx, vuMemBase, vif->tag.addr);
|
const bool isFill = (vifRegs->cycle.cl < vifRegs->cycle.wl);
|
||||||
const u8 upkNum = vif->cmd & 0x1f;
|
const u8 upkNum = vif->cmd & 0x1f;
|
||||||
const int usn = !!(vif->usn);
|
const VUFT& ft = VIFfuncTable[upkNum];
|
||||||
const VIFUnpackFuncTable& ft = VIFfuncTable[upkNum];
|
|
||||||
UNPACKFUNCTYPE func = usn ? ft.funcU : ft.funcS;
|
|
||||||
const int diff = ft.gsize - v.partTransfer;
|
const int diff = ft.gsize - v.partTransfer;
|
||||||
memcpy(&v.partBuffer[v.partTransfer], data, diff);
|
memcpy(&v.partBuffer[v.partTransfer], data, diff);
|
||||||
func((u32*)dest, (u32*)v.partBuffer);
|
UnpackSingleTable[idx][doMode][isFill]( v.partBuffer, size );
|
||||||
data += diff;
|
data += diff;
|
||||||
size -= diff;
|
size -= diff;
|
||||||
vifRegs->num--;
|
|
||||||
vif->tag.addr += 16;
|
vif->tag.addr += 16;
|
||||||
v.partTransfer = 0;
|
v.partTransfer = 0;
|
||||||
//DevCon.WriteLn("Diff = %d", diff);
|
//DevCon.WriteLn("Diff = %d", diff);
|
||||||
|
@ -171,7 +168,7 @@ static void setMasks(int idx, const VIFregisters& v) {
|
||||||
// elimination that it would probably be a win in most cases (and for sure in many
|
// elimination that it would probably be a win in most cases (and for sure in many
|
||||||
// "slow" games that need it most). --air
|
// "slow" games that need it most). --air
|
||||||
|
|
||||||
template< int idx, bool doMode, bool isFill >
|
template< int idx, bool doMode, bool isFill, bool singleUnpack >
|
||||||
__releaseinline void __fastcall _nVifUnpackLoop(u8 *data, u32 size) {
|
__releaseinline void __fastcall _nVifUnpackLoop(u8 *data, u32 size) {
|
||||||
|
|
||||||
const int cycleSize = isFill ? vifRegs->cycle.cl : vifRegs->cycle.wl;
|
const int cycleSize = isFill ? vifRegs->cycle.cl : vifRegs->cycle.wl;
|
||||||
|
@ -217,8 +214,10 @@ __releaseinline void __fastcall _nVifUnpackLoop(u8 *data, u32 size) {
|
||||||
vifRegs->num--;
|
vifRegs->num--;
|
||||||
incVUptrBy16(idx, dest, vuMemBase);
|
incVUptrBy16(idx, dest, vuMemBase);
|
||||||
if (++vif->cl == blockSize) vif->cl = 0;
|
if (++vif->cl == blockSize) vif->cl = 0;
|
||||||
|
if (singleUnpack) break;
|
||||||
}
|
}
|
||||||
else if (isFill) {
|
else if (isFill) {
|
||||||
|
//DevCon.WriteLn("isFill!");
|
||||||
func((u32*)dest, (u32*)data);
|
func((u32*)dest, (u32*)data);
|
||||||
vifRegs->num--;
|
vifRegs->num--;
|
||||||
incVUptrBy16(idx, dest, vuMemBase);
|
incVUptrBy16(idx, dest, vuMemBase);
|
||||||
|
@ -231,21 +230,6 @@ __releaseinline void __fastcall _nVifUnpackLoop(u8 *data, u32 size) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef void (__fastcall* Fnptr_VifUnpackLoop)(u8 *data, u32 size);
|
|
||||||
|
|
||||||
static const __aligned16 Fnptr_VifUnpackLoop UnpackLoopTable[2][2][2] =
|
|
||||||
{
|
|
||||||
{
|
|
||||||
{ _nVifUnpackLoop<0,false,false>, _nVifUnpackLoop<0,false,true> },
|
|
||||||
{ _nVifUnpackLoop<0,true, false>, _nVifUnpackLoop<0,true, true> },
|
|
||||||
},
|
|
||||||
{
|
|
||||||
{ _nVifUnpackLoop<1,false,false>, _nVifUnpackLoop<1,false,true> },
|
|
||||||
{ _nVifUnpackLoop<1,true, false>, _nVifUnpackLoop<1,true, true> },
|
|
||||||
},
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
_f void _nVifUnpack(int idx, u8 *data, u32 size) {
|
_f void _nVifUnpack(int idx, u8 *data, u32 size) {
|
||||||
|
|
||||||
if (useOldUnpack) {
|
if (useOldUnpack) {
|
||||||
|
@ -258,8 +242,4 @@ _f void _nVifUnpack(int idx, u8 *data, u32 size) {
|
||||||
const bool isFill = (vifRegs->cycle.cl < vifRegs->cycle.wl);
|
const bool isFill = (vifRegs->cycle.cl < vifRegs->cycle.wl);
|
||||||
|
|
||||||
UnpackLoopTable[idx][doMode][isFill]( data, size );
|
UnpackLoopTable[idx][doMode][isFill]( data, size );
|
||||||
|
|
||||||
//if (isFill)
|
|
||||||
//DevCon.WriteLn("%s Write! [num = %d][%s]", (isFill?"Filling":"Skipping"), vifRegs->num, (vifRegs->num%3 ? "bad!" : "ok"));
|
|
||||||
//DevCon.WriteLn("%s Write! [mask = %08x][type = %02d][num = %d]", (isFill?"Filling":"Skipping"), vifRegs->mask, upkNum, vifRegs->num);
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue