newVif: Rewrote the way partial transfers are handled.

The code is very simple now and doesn't need the vif unpack interpreter anymore for partial transfers.

Need some more testing done before I remove the code for the old way...

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2549 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
cottonvibes 2010-02-02 05:01:13 +00:00
parent 300717df6c
commit 9356d311eb
2 changed files with 23 additions and 12 deletions

View File

@ -29,12 +29,11 @@ vifStruct vif1;
__forceinline void vif1FLUSH() __forceinline void vif1FLUSH()
{ {
int _cycles = VU1.cycle; if (VU0.VI[REG_VPU_STAT].UL & 0x100)
{
int _cycles = VU1.cycle;
if (VU0.VI[REG_VPU_STAT].UL & 0x100) { do { CpuVU1->ExecuteBlock(); }
do {
CpuVU1->ExecuteBlock();
}
while (VU0.VI[REG_VPU_STAT].UL & 0x100); while (VU0.VI[REG_VPU_STAT].UL & 0x100);
g_vifCycles += (VU1.cycle - _cycles) * BIAS; g_vifCycles += (VU1.cycle - _cycles) * BIAS;

View File

@ -118,7 +118,7 @@ int nVifUnpack(int idx, u8* data) {
const int ret = aMin(vif->vifpacketsize, vif->tag.size); const int ret = aMin(vif->vifpacketsize, vif->tag.size);
const bool isFill = (vifRegs->cycle.cl < vifRegs->cycle.wl); const bool isFill = (vifRegs->cycle.cl < vifRegs->cycle.wl);
s32 size = ret << 2; s32 size = ret << 2;
/*
if (v.partTransfer) { // Last transfer was a partial vector transfer... if (v.partTransfer) { // Last transfer was a partial vector transfer...
const u8& vifT = nVifT[vif->cmd & 0xf]; const u8& vifT = nVifT[vif->cmd & 0xf];
const bool doMode = !!vifRegs->mode; const bool doMode = !!vifRegs->mode;
@ -131,17 +131,29 @@ int nVifUnpack(int idx, u8* data) {
size -= diff; size -= diff;
v.partTransfer = 0; v.partTransfer = 0;
} }
*/
static u8 buffer[2][0x4000] = {0};
static int bSize [2] = {0};
if (ret == v.vif->tag.size) { // Full Transfer if (ret == v.vif->tag.size) { // Full Transfer
if (bSize) {
memcpy(&buffer[idx][bSize[idx]], data, size);
bSize[idx] += size;
data = buffer[idx];
size = bSize [idx];
}
if (size > 0) { if (size > 0) {
if (newVifDynaRec) dVifUnpack(idx, data, size, isFill); if (newVifDynaRec) dVifUnpack(idx, data, size, isFill);
else _nVifUnpack(idx, data, size, isFill); else _nVifUnpack(idx, data, size, isFill);
} else if (isFill) _nVifUnpack(idx, data, size, isFill); } else if (isFill) _nVifUnpack(idx, data, size, isFill);
vif->tag.size = 0; vif->tag.size = 0;
vif->cmd = 0; vif->cmd = 0;
bSize[idx] = 0;
} }
else { // Partial Transfer else { // Partial Transfer
_nVifUnpack(idx, data, size, isFill); //_nVifUnpack(idx, data, size, isFill);
memcpy(&buffer[idx][bSize[idx]], data, size);
bSize[idx] += size;
vif->tag.size -= ret; vif->tag.size -= ret;
} }
@ -251,11 +263,11 @@ __releaseinline void __fastcall _nVifUnpackLoop(u8 *data, u32 size) {
} }
} }
if (vifRegs->num && ((s32)size > 0)) { // Partial Vector Transfer //if (vifRegs->num && ((s32)size > 0)) { // Partial Vector Transfer
//DevCon.WriteLn("partial transfer! [%d]", size); // //DevCon.WriteLn("partial transfer! [%d]", size);
memcpy(nVif[idx].partBuffer, data, size); // memcpy(nVif[idx].partBuffer, data, size);
nVif[idx].partTransfer = size; // nVif[idx].partTransfer = size;
} //}
} }
_f void _nVifUnpack(int idx, u8 *data, u32 size, bool isFill) { _f void _nVifUnpack(int idx, u8 *data, u32 size, bool isFill) {