From af66887d0c96f9e502e47ef2f00a1ab538b3816e Mon Sep 17 00:00:00 2001 From: "Jake.Stine" Date: Thu, 24 Dec 2009 02:30:05 +0000 Subject: [PATCH] newVif bug fixes (mostly related to the interpreted version), and switched it back off again. >_< git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2392 96395faa-99c1-11dd-bbfe-3dabce05a288 --- pcsx2/Vif1Dma.cpp | 7 ++++--- pcsx2/VifDma.cpp | 4 ++-- pcsx2/VifDma_internal.h | 4 ++-- pcsx2/x86/VifUnpackSSE.cpp | 9 ++++----- pcsx2/x86/VifUnpackSSE.h | 9 +++++++-- pcsx2/x86/newVif.h | 4 ++-- 6 files changed, 21 insertions(+), 16 deletions(-) diff --git a/pcsx2/Vif1Dma.cpp b/pcsx2/Vif1Dma.cpp index 999ff250df..a8a116d734 100644 --- a/pcsx2/Vif1Dma.cpp +++ b/pcsx2/Vif1Dma.cpp @@ -58,7 +58,7 @@ __forceinline void vif1FLUSH() void vif1Init() { -#ifdef newVif1 +#if newVif1 extern void initNewVif(int idx); initNewVif(1); #endif @@ -320,8 +320,9 @@ static int __fastcall Vif1TransDirectHL(u32 *data) } static int __fastcall Vif1TransUnpack(u32 *data) { - if( newVif1 ) - return nVifUnpack(1, (u8*)data); + #if newVif1 + return nVifUnpack(1, (u8*)data); + #endif XMMRegisters::Freeze(); diff --git a/pcsx2/VifDma.cpp b/pcsx2/VifDma.cpp index 16d6aa0dbd..865069e43b 100644 --- a/pcsx2/VifDma.cpp +++ b/pcsx2/VifDma.cpp @@ -413,7 +413,7 @@ template u32 VIFalign(u32 *data, vifCode *v, u32 size) return size>>2; } #include "newVif.h" -#ifndef newVif +#if !newVif template void VIFunpack<0>(u32 *data, vifCode *v, u32 size); template void VIFunpack<1>(u32 *data, vifCode *v, u32 size); template void VIFunpack(u32 *data, vifCode *v, u32 size) @@ -738,7 +738,7 @@ template void VIFunpack(u32 *data, vifCode *v, u32 size) } } } -#endif // #ifndef newVif +#endif // #if !newVif template void vuExecMicro<0>(u32 addr); template void vuExecMicro<1>(u32 addr); diff --git a/pcsx2/VifDma_internal.h b/pcsx2/VifDma_internal.h index b4cd5e14b2..21dd1c7fc0 100644 --- a/pcsx2/VifDma_internal.h +++ b/pcsx2/VifDma_internal.h @@ -85,8 +85,8 @@ static __forceinline u32 vif_size(u8 num) // All defines are enabled with '1' or disabled with '0' -#define newVif 1 // Enable 'newVif' Code (if the below macros are not defined, it will use old non-sse code) -#define newVif1 1 // Use New Code for Vif1 Unpacks (needs newVif defined) +#define newVif 0 // Enable 'newVif' Code (if the below macros are not defined, it will use old non-sse code) +#define newVif1 0 // Use New Code for Vif1 Unpacks (needs newVif defined) #define newVif0 0 // Use New Code for Vif0 Unpacks (not implemented) #if newVif diff --git a/pcsx2/x86/VifUnpackSSE.cpp b/pcsx2/x86/VifUnpackSSE.cpp index e81ff68103..323b4b4a50 100644 --- a/pcsx2/x86/VifUnpackSSE.cpp +++ b/pcsx2/x86/VifUnpackSSE.cpp @@ -36,8 +36,8 @@ VifUnpackSSE_Base::VifUnpackSSE_Base() } void VifUnpackSSE_Base::xMovDest(const xRegisterSSE& srcReg) const { - if (!doMode && !doMask) { xMOVAPS (ptr[dstIndirect], srcReg); } - else { doMaskWrite(srcReg); } + if (IsUnmaskedOp()) { xMOVAPS (ptr[dstIndirect], srcReg); } + else { doMaskWrite(srcReg); } } void VifUnpackSSE_Base::xShiftR(const xRegisterSSE& regX, int n) const { @@ -197,7 +197,7 @@ void VifUnpackSSE_Base::xUPK_V4_5() const { xMovDest (xmm1); } -void VifUnpackSSE_Base::xUnpack( int upknum ) +void VifUnpackSSE_Base::xUnpack( int upknum ) const { switch( upknum ) { @@ -252,13 +252,12 @@ static void nVifGen(int usn, int mask, int curCycle) { int usnpart = usn*2*16; int maskpart = mask*16; - int curpart = curCycle; VifUnpackSSE_Simple vpugen( !!usn, !!mask, curCycle ); for( int i=0; i<16; ++i ) { - nVifCall& ucall( nVifUpk[((usnpart+maskpart+i) * 4) + (curpart)] ); + nVifCall& ucall( nVifUpk[((usnpart+maskpart+i) * 4) + curCycle] ); ucall = NULL; if( nVifT[i] == 0 ) continue; diff --git a/pcsx2/x86/VifUnpackSSE.h b/pcsx2/x86/VifUnpackSSE.h index f52de0f553..9bf7160026 100644 --- a/pcsx2/x86/VifUnpackSSE.h +++ b/pcsx2/x86/VifUnpackSSE.h @@ -34,7 +34,6 @@ class VifUnpackSSE_Base public: bool usn; // unsigned flag bool doMask; // masking write enable flag - int doMode; // two bit value representing... something! protected: xAddressInfo dstIndirect; @@ -44,7 +43,8 @@ public: VifUnpackSSE_Base(); virtual ~VifUnpackSSE_Base() throw() {} - void xUnpack( int upktype ); + virtual void xUnpack( int upktype ) const; + virtual bool IsUnmaskedOp() const=0; protected: virtual void doMaskWrite(const xRegisterSSE& regX ) const=0; @@ -87,6 +87,8 @@ public: VifUnpackSSE_Simple(bool usn_, bool domask_, int curCycle_); virtual ~VifUnpackSSE_Simple() throw() {} + virtual bool IsUnmaskedOp() const{ return !doMask; } + protected: virtual void doMaskWrite(const xRegisterSSE& regX ) const; }; @@ -100,6 +102,7 @@ class VifUnpackSSE_Dynarec : public VifUnpackSSE_Base public: bool isFill; + int doMode; // two bit value representing... something! protected: const nVifStruct& v; // vif0 or vif1 @@ -119,6 +122,8 @@ public: virtual ~VifUnpackSSE_Dynarec() throw() {} + virtual bool IsUnmaskedOp() const{ return !doMode && !doMask; } + void CompileRoutine(); protected: diff --git a/pcsx2/x86/newVif.h b/pcsx2/x86/newVif.h index e8a6782df7..a253e2490b 100644 --- a/pcsx2/x86/newVif.h +++ b/pcsx2/x86/newVif.h @@ -99,7 +99,7 @@ extern __aligned16 const u8 nVifT[32]; extern __aligned16 nVifCall nVifUpk[(2*2*16) *4]; // ([USN][Masking][Unpack Type]) [curCycle] extern __aligned16 u32 nVifMask[3][4][4]; // [MaskNumber][CycleNumber][Vector] -static const bool useOldUnpack = false; // Use code in newVif_OldUnpack.inl -static const bool newVifDynaRec = true; // Use code in newVif_Dynarec.inl +static const bool useOldUnpack = false; // Use code in newVif_OldUnpack.inl +static const bool newVifDynaRec = true; // Use code in newVif_Dynarec.inl #endif