From a5208c42273d8b3b05fa0eeccc3fa951e5d010f7 Mon Sep 17 00:00:00 2001 From: cottonvibes Date: Tue, 22 Jun 2010 08:56:40 +0000 Subject: [PATCH] microVU: Took me about 5 hours to figure out the problem, but finally fixed the problem with Sly Cooper running at 1 fps with mVU... The problem was that the game does a branch in a branch delay slot, and mVU wasn't setting some pipeline state variable in this case correctly. This in turn caused the pipeline state comparison for the block to always be wrong, which meant a new block would always be recompiled whenever this specific block was to be executed. This ended up happening 1000's of times slowing down the game to 1 fps... git-svn-id: http://pcsx2.googlecode.com/svn/trunk@3266 96395faa-99c1-11dd-bbfe-3dabce05a288 --- pcsx2/x86/microVU.h | 11 ++++++++--- pcsx2/x86/microVU_Compile.inl | 4 ++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/pcsx2/x86/microVU.h b/pcsx2/x86/microVU.h index 90b7d2ca4d..3a5af77966 100644 --- a/pcsx2/x86/microVU.h +++ b/pcsx2/x86/microVU.h @@ -102,9 +102,14 @@ public: if (listI < 7) return; microBlockLink* linkI = &blockList; for (int i = 0; i <= listI; i++) { - DevCon.WriteLn( Color_Green, "[%04x][Block #%d][q=%02d][p=%02d][xgkick=%d][vi15=%08x][viBackup=%02d][flags=%02x][exactMatch=%x]", - pc, i, linkI->block->pState.q, linkI->block->pState.p, linkI->block->pState.xgkick, linkI->block->pState.vi15, - linkI->block->pState.viBackUp, linkI->block->pState.flags, linkI->block->pState.needExactMatch); + u32 viCRC = 0, vfCRC = 0, crc = 0, z = sizeof(microRegInfo)/4; + for (u32 j = 0; j < 4; j++) viCRC -= ((u32*)linkI->block->pState.VI)[j]; + for (u32 j = 0; j < 32; j++) vfCRC -= linkI->block->pState.VF[j].reg; + for (u32 j = 0; j < z; j++) crc -= ((u32*)&linkI->block->pState)[j]; + DevCon.WriteLn(Color_Green, "[%04x][Block #%d][crc=%08x][q=%02d][p=%02d][xgkick=%d][vi15=%08x][viBackup=%02d]" + "[flags=%02x][exactMatch=%x][blockType=%d][viCRC=%08x][vfCRC=%08x]", pc, i, crc, linkI->block->pState.q, + linkI->block->pState.p, linkI->block->pState.xgkick, linkI->block->pState.vi15, linkI->block->pState.viBackUp, + linkI->block->pState.flags, linkI->block->pState.needExactMatch, linkI->block->pState.blockType, viCRC, vfCRC); linkI = linkI->next; } } diff --git a/pcsx2/x86/microVU_Compile.inl b/pcsx2/x86/microVU_Compile.inl index afea8a5425..c6e654aa92 100644 --- a/pcsx2/x86/microVU_Compile.inl +++ b/pcsx2/x86/microVU_Compile.inl @@ -350,11 +350,11 @@ _f void mVUinitFirstPass(microVU* mVU, uptr pState, u8* thisPtr) { memcpy_const((u8*)&mVU->prog.lpState, (u8*)pState, sizeof(microRegInfo)); } mVUblock.x86ptrStart = thisPtr; - mVUpBlock = mVUblocks[mVUstartPC/2]->add(&mVUblock); // Add this block to block manager + mVUpBlock = mVUblocks[mVUstartPC/2]->add(&mVUblock); // Add this block to block manager + mVUregs.needExactMatch =(mVUregs.blockType || noFlagOpts) ? 7 : 0; // 1-Op blocks should just always set exactMatch (Sly Cooper) mVUregs.blockType = 0; mVUregs.viBackUp = 0; mVUregs.flags = 0; - mVUregs.needExactMatch = 0; mVUsFlagHack = CHECK_VU_FLAGHACK; mVUinitConstValues(mVU); }