diff --git a/pcsx2/Linux/pcsx2.cbp b/pcsx2/Linux/pcsx2.cbp index a6b60e64c1..6b7c1d6da7 100644 --- a/pcsx2/Linux/pcsx2.cbp +++ b/pcsx2/Linux/pcsx2.cbp @@ -515,9 +515,9 @@ - - - + + + diff --git a/pcsx2/Vif1Dma.cpp b/pcsx2/Vif1Dma.cpp index 1a7f07d7c0..999ff250df 100644 --- a/pcsx2/Vif1Dma.cpp +++ b/pcsx2/Vif1Dma.cpp @@ -320,9 +320,8 @@ static int __fastcall Vif1TransDirectHL(u32 *data) } static int __fastcall Vif1TransUnpack(u32 *data) { -#ifdef newVif1 - return nVifUnpack(1, (u8*)data); -#endif + if( newVif1 ) + return nVifUnpack(1, (u8*)data); XMMRegisters::Freeze(); diff --git a/pcsx2/VifDma_internal.h b/pcsx2/VifDma_internal.h index 806cd2ec69..b4cd5e14b2 100644 --- a/pcsx2/VifDma_internal.h +++ b/pcsx2/VifDma_internal.h @@ -83,11 +83,13 @@ static __forceinline u32 vif_size(u8 num) return (num == 0) ? 0x1000 : 0x4000; } -//#define newVif // Enable 'newVif' Code (if the below macros are not defined, it will use old non-sse code) -//#define newVif1 // Use New Code for Vif1 Unpacks (needs newVif defined) -//#define newVif0 // Use New Code for Vif0 Unpacks (not implemented) +// All defines are enabled with '1' or disabled with '0' -#ifdef newVif +#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 newVif0 0 // Use New Code for Vif0 Unpacks (not implemented) + +#if newVif extern int nVifUnpack(int idx, u8 *data); #else //# define NON_SSE_UNPACKS // Turns off SSE Unpacks (slower) diff --git a/pcsx2/windows/VCprojects/pcsx2_2008.vcproj b/pcsx2/windows/VCprojects/pcsx2_2008.vcproj index e98f527dce..37326f319e 100644 --- a/pcsx2/windows/VCprojects/pcsx2_2008.vcproj +++ b/pcsx2/windows/VCprojects/pcsx2_2008.vcproj @@ -871,19 +871,15 @@ Name="Dynarec" > - - diff --git a/pcsx2/x86/VpuUnpackSSE.cpp b/pcsx2/x86/VifUnpackSSE.cpp similarity index 83% rename from pcsx2/x86/VpuUnpackSSE.cpp rename to pcsx2/x86/VifUnpackSSE.cpp index 00949a3c04..e81ff68103 100644 --- a/pcsx2/x86/VpuUnpackSSE.cpp +++ b/pcsx2/x86/VifUnpackSSE.cpp @@ -14,9 +14,9 @@ */ #include "PrecompiledHeader.h" -#include "VpuUnpackSSE.h" +#include "VifUnpackSSE.h" -#ifdef newVif +#if newVif #define xMOV8(regX, loc) xMOVSSZX(regX, loc) #define xMOV16(regX, loc) xMOVSSZX(regX, loc) @@ -27,41 +27,41 @@ static __pagealigned u8 nVifUpkExec[__pagesize*4]; // ===================================================================================================== -// VpuUnpackSSE_Base Section +// VifUnpackSSE_Base Section // ===================================================================================================== -VpuUnpackSSE_Base::VpuUnpackSSE_Base() +VifUnpackSSE_Base::VifUnpackSSE_Base() : dstIndirect(ecx) // parameter 1 of __fastcall , srcIndirect(edx) // parameter 2 of __fastcall { } -void VpuUnpackSSE_Base::xMovDest(const xRegisterSSE& srcReg) const { +void VifUnpackSSE_Base::xMovDest(const xRegisterSSE& srcReg) const { if (!doMode && !doMask) { xMOVAPS (ptr[dstIndirect], srcReg); } else { doMaskWrite(srcReg); } } -void VpuUnpackSSE_Base::xShiftR(const xRegisterSSE& regX, int n) const { +void VifUnpackSSE_Base::xShiftR(const xRegisterSSE& regX, int n) const { if (usn) { xPSRL.D(regX, n); } else { xPSRA.D(regX, n); } } -void VpuUnpackSSE_Base::xPMOVXX8(const xRegisterSSE& regX) const { +void VifUnpackSSE_Base::xPMOVXX8(const xRegisterSSE& regX) const { if (usn) xPMOVZX.BD(regX, ptr32[srcIndirect]); else xPMOVSX.BD(regX, ptr32[srcIndirect]); } -void VpuUnpackSSE_Base::xPMOVXX16(const xRegisterSSE& regX) const { +void VifUnpackSSE_Base::xPMOVXX16(const xRegisterSSE& regX) const { if (usn) xPMOVZX.WD(regX, ptr64[srcIndirect]); else xPMOVSX.WD(regX, ptr64[srcIndirect]); } -void VpuUnpackSSE_Base::xUPK_S_32() const { +void VifUnpackSSE_Base::xUPK_S_32() const { xMOV32 (xmm0, ptr32[srcIndirect]); xPSHUF.D (xmm1, xmm0, _v0); xMovDest (xmm1); } -void VpuUnpackSSE_Base::xUPK_S_16() const { +void VifUnpackSSE_Base::xUPK_S_16() const { if (x86caps.hasStreamingSIMD4Extensions) { xPMOVXX16 (xmm0); } @@ -74,7 +74,7 @@ else { xMovDest (xmm1); } -void VpuUnpackSSE_Base::xUPK_S_8() const { +void VifUnpackSSE_Base::xUPK_S_8() const { if (x86caps.hasStreamingSIMD4Extensions) { xPMOVXX8 (xmm0); } @@ -88,12 +88,12 @@ else { xMovDest (xmm1); } -void VpuUnpackSSE_Base::xUPK_V2_32() const { +void VifUnpackSSE_Base::xUPK_V2_32() const { xMOV64 (xmm0, ptr32[srcIndirect]); xMovDest (xmm0); } -void VpuUnpackSSE_Base::xUPK_V2_16() const { +void VifUnpackSSE_Base::xUPK_V2_16() const { if (x86caps.hasStreamingSIMD4Extensions) { xPMOVXX16 (xmm0); } @@ -105,7 +105,7 @@ else { xMovDest (xmm0); } -void VpuUnpackSSE_Base::xUPK_V2_8() const { +void VifUnpackSSE_Base::xUPK_V2_8() const { if (x86caps.hasStreamingSIMD4Extensions) { xPMOVXX8 (xmm0); } @@ -118,12 +118,12 @@ else { xMovDest (xmm0); } -void VpuUnpackSSE_Base::xUPK_V3_32() const { +void VifUnpackSSE_Base::xUPK_V3_32() const { xMOV128 (xmm0, ptr32[srcIndirect]); xMovDest (xmm0); } -void VpuUnpackSSE_Base::xUPK_V3_16() const { +void VifUnpackSSE_Base::xUPK_V3_16() const { if (x86caps.hasStreamingSIMD4Extensions) { xPMOVXX16 (xmm0); } @@ -135,7 +135,7 @@ else { xMovDest (xmm0); } -void VpuUnpackSSE_Base::xUPK_V3_8() const { +void VifUnpackSSE_Base::xUPK_V3_8() const { if (x86caps.hasStreamingSIMD4Extensions) { xPMOVXX8 (xmm0); } @@ -148,12 +148,12 @@ else { xMovDest (xmm0); } -void VpuUnpackSSE_Base::xUPK_V4_32() const { +void VifUnpackSSE_Base::xUPK_V4_32() const { xMOV128 (xmm0, ptr32[srcIndirect]); xMovDest (xmm0); } -void VpuUnpackSSE_Base::xUPK_V4_16() const { +void VifUnpackSSE_Base::xUPK_V4_16() const { if (x86caps.hasStreamingSIMD4Extensions) { xPMOVXX16 (xmm0); } @@ -165,7 +165,7 @@ else { xMovDest (xmm0); } -void VpuUnpackSSE_Base::xUPK_V4_8() const { +void VifUnpackSSE_Base::xUPK_V4_8() const { if (x86caps.hasStreamingSIMD4Extensions) { xPMOVXX8 (xmm0); } @@ -178,7 +178,7 @@ else { xMovDest (xmm0); } -void VpuUnpackSSE_Base::xUPK_V4_5() const { +void VifUnpackSSE_Base::xUPK_V4_5() const { xMOV16 (xmm0, ptr32[srcIndirect]); xPSHUF.D (xmm0, xmm0, _v0); xPSLL.D (xmm0, 3); // ABG|R5.000 @@ -197,7 +197,7 @@ void VpuUnpackSSE_Base::xUPK_V4_5() const { xMovDest (xmm1); } -void VpuUnpackSSE_Base::xUnpack( int upknum ) +void VifUnpackSSE_Base::xUnpack( int upknum ) { switch( upknum ) { @@ -227,17 +227,17 @@ void VpuUnpackSSE_Base::xUnpack( int upknum ) } // ===================================================================================================== -// VpuUnpackSSE_Simple +// VifUnpackSSE_Simple // ===================================================================================================== -VpuUnpackSSE_Simple::VpuUnpackSSE_Simple(bool usn_, bool domask_, int curCycle_) +VifUnpackSSE_Simple::VifUnpackSSE_Simple(bool usn_, bool domask_, int curCycle_) { curCycle = curCycle_; usn = usn_; doMask = domask_; } -void VpuUnpackSSE_Simple::doMaskWrite(const xRegisterSSE& regX) const { +void VifUnpackSSE_Simple::doMaskWrite(const xRegisterSSE& regX) const { xMOVAPS(xmm7, ptr[dstIndirect]); int offX = aMin(curCycle, 3); xPAND(regX, ptr32[nVifMask[0][offX]]); @@ -254,7 +254,7 @@ static void nVifGen(int usn, int mask, int curCycle) { int maskpart = mask*16; int curpart = curCycle; - VpuUnpackSSE_Simple vpugen( !!usn, !!mask, curCycle ); + VifUnpackSSE_Simple vpugen( !!usn, !!mask, curCycle ); for( int i=0; i<16; ++i ) { @@ -270,7 +270,7 @@ static void nVifGen(int usn, int mask, int curCycle) { } } -void VpuUnpackSSE_Init() +void VifUnpackSSE_Init() { HostSys::MemProtectStatic(nVifUpkExec, Protect_ReadWrite, false); memset8<0xcc>( nVifUpkExec ); diff --git a/pcsx2/x86/VpuUnpackSSE.h b/pcsx2/x86/VifUnpackSSE.h similarity index 80% rename from pcsx2/x86/VpuUnpackSSE.h rename to pcsx2/x86/VifUnpackSSE.h index 8d36399f3b..f52de0f553 100644 --- a/pcsx2/x86/VpuUnpackSSE.h +++ b/pcsx2/x86/VifUnpackSSE.h @@ -24,12 +24,12 @@ using namespace x86Emitter; -#ifdef newVif +#if newVif // -------------------------------------------------------------------------------------- -// VpuUnpackSSE_Base +// VifUnpackSSE_Base // -------------------------------------------------------------------------------------- -class VpuUnpackSSE_Base +class VifUnpackSSE_Base { public: bool usn; // unsigned flag @@ -41,8 +41,8 @@ protected: xAddressInfo srcIndirect; public: - VpuUnpackSSE_Base(); - virtual ~VpuUnpackSSE_Base() throw() {} + VifUnpackSSE_Base(); + virtual ~VifUnpackSSE_Base() throw() {} void xUnpack( int upktype ); @@ -74,29 +74,29 @@ protected: }; // -------------------------------------------------------------------------------------- -// VpuUnpackSSE_Simple +// VifUnpackSSE_Simple // -------------------------------------------------------------------------------------- -class VpuUnpackSSE_Simple : public VpuUnpackSSE_Base +class VifUnpackSSE_Simple : public VifUnpackSSE_Base { - typedef VpuUnpackSSE_Base _parent; + typedef VifUnpackSSE_Base _parent; public: int curCycle; public: - VpuUnpackSSE_Simple(bool usn_, bool domask_, int curCycle_); - virtual ~VpuUnpackSSE_Simple() throw() {} + VifUnpackSSE_Simple(bool usn_, bool domask_, int curCycle_); + virtual ~VifUnpackSSE_Simple() throw() {} protected: virtual void doMaskWrite(const xRegisterSSE& regX ) const; }; // -------------------------------------------------------------------------------------- -// VpuUnpackSSE_Dynarec +// VifUnpackSSE_Dynarec // -------------------------------------------------------------------------------------- -class VpuUnpackSSE_Dynarec : public VpuUnpackSSE_Base +class VifUnpackSSE_Dynarec : public VifUnpackSSE_Base { - typedef VpuUnpackSSE_Base _parent; + typedef VifUnpackSSE_Base _parent; public: bool isFill; @@ -107,8 +107,8 @@ protected: int vCL; // internal copy of vif->cl public: - VpuUnpackSSE_Dynarec(const nVifStruct& vif_, const nVifBlock& vifBlock_); - VpuUnpackSSE_Dynarec(const VpuUnpackSSE_Dynarec& src) // copy constructor + VifUnpackSSE_Dynarec(const nVifStruct& vif_, const nVifBlock& vifBlock_); + VifUnpackSSE_Dynarec(const VifUnpackSSE_Dynarec& src) // copy constructor : _parent(src) , v(src.v) , vB(src.vB) @@ -117,7 +117,7 @@ public: vCL = src.vCL; } - virtual ~VpuUnpackSSE_Dynarec() throw() {} + virtual ~VifUnpackSSE_Dynarec() throw() {} void CompileRoutine(); @@ -126,9 +126,9 @@ protected: void SetMasks(int cS) const; void writeBackRow() const; - static VpuUnpackSSE_Dynarec FillingWrite( const VpuUnpackSSE_Dynarec& src ) + static VifUnpackSSE_Dynarec FillingWrite( const VifUnpackSSE_Dynarec& src ) { - VpuUnpackSSE_Dynarec fillingWrite( src ); + VifUnpackSSE_Dynarec fillingWrite( src ); fillingWrite.doMask = true; fillingWrite.doMode = 0; return fillingWrite; diff --git a/pcsx2/x86/VpuUnpackSSE_Dynarec.cpp b/pcsx2/x86/VifUnpackSSE_Dynarec.cpp similarity index 92% rename from pcsx2/x86/VpuUnpackSSE_Dynarec.cpp rename to pcsx2/x86/VifUnpackSSE_Dynarec.cpp index 22e274433d..dbe6f3e779 100644 --- a/pcsx2/x86/VpuUnpackSSE_Dynarec.cpp +++ b/pcsx2/x86/VifUnpackSSE_Dynarec.cpp @@ -18,9 +18,9 @@ // Jake.Stine (@gmail.com) #include "PrecompiledHeader.h" -#include "VpuUnpackSSE.h" +#include "VifUnpackSSE.h" -#ifdef newVif +#if newVif static __aligned16 nVifBlock _vBlock = {0}; static __pagealigned u8 nVifMemCmp[__pagesize]; @@ -77,7 +77,7 @@ static void loadRowCol(nVifStruct& v) { xPSHUF.D(xmm5, xmm5, _v0); } -VpuUnpackSSE_Dynarec::VpuUnpackSSE_Dynarec(const nVifStruct& vif_, const nVifBlock& vifBlock_) +VifUnpackSSE_Dynarec::VifUnpackSSE_Dynarec(const nVifStruct& vif_, const nVifBlock& vifBlock_) : v(vif_) , vB(vifBlock_) { @@ -91,7 +91,7 @@ VpuUnpackSSE_Dynarec::VpuUnpackSSE_Dynarec(const nVifStruct& vif_, const nVifBlo x = ((x&0x40)>>6) | ((x&0x10)>>3) | (x&4) | ((x&1)<<3); \ } -_f void VpuUnpackSSE_Dynarec::SetMasks(int cS) const { +_f void VifUnpackSSE_Dynarec::SetMasks(int cS) const { u32 m0 = vB.mask; u32 m1 = m0 & 0xaaaaaaaa; u32 m2 =(~m1>>1) & m0; @@ -109,7 +109,7 @@ _f void VpuUnpackSSE_Dynarec::SetMasks(int cS) const { //if (mask||mode) loadRowCol(v); } -void VpuUnpackSSE_Dynarec::doMaskWrite(const xRegisterSSE& regX) const { +void VifUnpackSSE_Dynarec::doMaskWrite(const xRegisterSSE& regX) const { pxAssumeDev(regX.Id <= 1, "Reg Overflow! XMM2 thru XMM6 are reserved for masking."); int cc = aMin(vCL, 3); u32 m0 = (vB.mask >> (cc * 8)) & 0xff; @@ -142,7 +142,7 @@ void VpuUnpackSSE_Dynarec::doMaskWrite(const xRegisterSSE& regX) const { xMOVAPS(ptr32[dstIndirect], regX); } -void VpuUnpackSSE_Dynarec::writeBackRow() const { +void VifUnpackSSE_Dynarec::writeBackRow() const { u32* row = (v.idx) ? g_vifmask.Row1 : g_vifmask.Row0; xMOVAPS(ptr32[row], xmmRow); DevCon.WriteLn("nVif: writing back row reg! [doMode = 2]"); @@ -164,7 +164,7 @@ static void ShiftDisplacementWindow( xAddressInfo& addr, const xRegister32& modR if(addImm) xADD(modReg, addImm); } -void VpuUnpackSSE_Dynarec::CompileRoutine() { +void VifUnpackSSE_Dynarec::CompileRoutine() { const int upkNum = vB.upkType & 0xf; const u8& vift = nVifT[upkNum]; const int cycleSize = isFill ? vB.cl : vB.wl; @@ -190,7 +190,7 @@ void VpuUnpackSSE_Dynarec::CompileRoutine() { } else if (isFill) { DevCon.WriteLn("filling mode!"); - VpuUnpackSSE_Dynarec::FillingWrite( *this ).xUnpack(upkNum); + VifUnpackSSE_Dynarec::FillingWrite( *this ).xUnpack(upkNum); dstIndirect += 16; vNum--; if (++vCL == blockSize) vCL = 0; @@ -269,7 +269,7 @@ _f void dVifUnpack(int idx, u8 *data, u32 size, bool isFill) { xSetPtr(v.recPtr); _vBlock.startPtr = (uptr)xGetAlignedCallTarget(); v.vifBlocks->add(_vBlock); - VpuUnpackSSE_Dynarec( v, _vBlock ).CompileRoutine(); + VifUnpackSSE_Dynarec( v, _vBlock ).CompileRoutine(); nVif[idx].recPtr = xGetPtr(); dVifRecLimit(idx); diff --git a/pcsx2/x86/newVif.h b/pcsx2/x86/newVif.h index ade06346f2..e8a6782df7 100644 --- a/pcsx2/x86/newVif.h +++ b/pcsx2/x86/newVif.h @@ -21,7 +21,7 @@ #include "x86emitter/x86emitter.h" using namespace x86Emitter; -#ifdef newVif +#if newVif // newVif_HashBucket.h uses this typedef, so it has to be decared first. typedef u32 (__fastcall *nVifCall)(void*, void*); @@ -34,7 +34,7 @@ extern void mVUmergeRegs(int dest, int src, int xyzw, bool modXYZW = 0); extern void _nVifUnpack (int idx, u8 *data, u32 size, bool isFill); extern void dVifUnpack (int idx, u8 *data, u32 size, bool isFill); extern void dVifInit (int idx); -extern void VpuUnpackSSE_Init(); +extern void VifUnpackSSE_Init(); #define VUFT VIFUnpackFuncTable #define _1mb (0x100000) diff --git a/pcsx2/x86/newVif_Unpack.cpp b/pcsx2/x86/newVif_Unpack.cpp index 8e7554e8c2..0f73363720 100644 --- a/pcsx2/x86/newVif_Unpack.cpp +++ b/pcsx2/x86/newVif_Unpack.cpp @@ -22,7 +22,7 @@ #include "VifDma_internal.h" #include "newVif.h" -#ifdef newVif +#if newVif #include "newVif_OldUnpack.inl" __aligned16 nVifStruct nVif[2]; @@ -88,7 +88,7 @@ void initNewVif(int idx) { nVif[idx].vifCache = NULL; nVif[idx].partTransfer = 0; - VpuUnpackSSE_Init(); + VifUnpackSSE_Init(); if (newVifDynaRec) dVifInit(idx); } @@ -97,7 +97,7 @@ static _f u8* setVUptr(int vuidx, const u8* vuMemBase, int offset) { } static _f void incVUptr(int vuidx, u8* &ptr, const u8* vuMemBase, int amount) { - pxAssert( ((uptr)ptr & 0xf) == 0 ); // alignment check + pxAssume( ((uptr)ptr & 0xf) == 0 ); // alignment check ptr += amount; int diff = ptr - (vuMemBase + (vuidx ? 0x4000 : 0x1000)); if (diff >= 0) { @@ -106,7 +106,7 @@ static _f void incVUptr(int vuidx, u8* &ptr, const u8* vuMemBase, int amount) { } static _f void incVUptrBy16(int vuidx, u8* &ptr, const u8* vuMemBase) { - pxAssert( ((uptr)ptr & 0xf) == 0 ); // alignment check + pxAssume( ((uptr)ptr & 0xf) == 0 ); // alignment check ptr += 16; if( ptr == (vuMemBase + (vuidx ? 0x4000 : 0x1000)) ) ptr -= (vuidx ? 0x4000 : 0x1000);