diff --git a/Source/Core/VideoCommon/BPFunctions.cpp b/Source/Core/VideoCommon/BPFunctions.cpp index a5cb6d9f66..76745e89e0 100644 --- a/Source/Core/VideoCommon/BPFunctions.cpp +++ b/Source/Core/VideoCommon/BPFunctions.cpp @@ -90,8 +90,9 @@ void SetColorMask() g_renderer->SetColorMask(); } -void CopyEFB(u32 dstAddr, unsigned int dstFormat, PEControl::PixelFormat srcFormat, - const EFBRectangle& srcRect, bool isIntensity, bool scaleByHalf) +void CopyEFB(u32 dstAddr, const EFBRectangle& srcRect, + unsigned int dstFormat, PEControl::PixelFormat srcFormat, + bool isIntensity, bool scaleByHalf) { // bpmem.zcontrol.pixel_format to PEControl::Z24 is when the game wants to copy from ZBuffer (Zbuffer uses 24-bit Format) if (g_ActiveConfig.bEFBCopyEnable) diff --git a/Source/Core/VideoCommon/BPFunctions.h b/Source/Core/VideoCommon/BPFunctions.h index f6df86c6a0..4a3b25c9de 100644 --- a/Source/Core/VideoCommon/BPFunctions.h +++ b/Source/Core/VideoCommon/BPFunctions.h @@ -24,8 +24,9 @@ void SetBlendMode(); void SetDitherMode(); void SetLogicOpMode(); void SetColorMask(); -void CopyEFB(u32 dstAddr, unsigned int dstFormat, PEControl::PixelFormat srcFormat, - const EFBRectangle& srcRect, bool isIntensity, bool scaleByHalf); +void CopyEFB(u32 dstAddr, const EFBRectangle& srcRect, + unsigned int dstFormat, PEControl::PixelFormat srcFormat, + bool isIntensity, bool scaleByHalf); void ClearScreen(const EFBRectangle &rc); void OnPixelFormatChange(); void SetInterlacingMode(const BPCmd &bp); diff --git a/Source/Core/VideoCommon/BPStructs.cpp b/Source/Core/VideoCommon/BPStructs.cpp index b8cd8d727e..20475fc5f5 100644 --- a/Source/Core/VideoCommon/BPStructs.cpp +++ b/Source/Core/VideoCommon/BPStructs.cpp @@ -198,14 +198,16 @@ static void BPWritten(const BPCmd& bp) // The bottom right is within the rectangle // The values in bpmem.copyTexSrcXY and bpmem.copyTexSrcWH are updated in case 0x49 and 0x4a in this function - EFBRectangle rc; - rc.left = (int)bpmem.copyTexSrcXY.x; - rc.top = (int)bpmem.copyTexSrcXY.y; + u32 destAddr = bpmem.copyTexDest << 5; + + EFBRectangle srcRect; + srcRect.left = (int)bpmem.copyTexSrcXY.x; + srcRect.top = (int)bpmem.copyTexSrcXY.y; // Here Width+1 like Height, otherwise some textures are corrupted already since the native resolution. // TODO: What's the behavior of out of bound access? - rc.right = (int)(bpmem.copyTexSrcXY.x + bpmem.copyTexSrcWH.x + 1); - rc.bottom = (int)(bpmem.copyTexSrcXY.y + bpmem.copyTexSrcWH.y + 1); + srcRect.right = (int)(bpmem.copyTexSrcXY.x + bpmem.copyTexSrcWH.x + 1); + srcRect.bottom = (int)(bpmem.copyTexSrcXY.y + bpmem.copyTexSrcWH.y + 1); UPE_Copy PE_copy = bpmem.triggerEFBCopy; @@ -213,11 +215,11 @@ static void BPWritten(const BPCmd& bp) if (PE_copy.copy_to_xfb == 0) { if (g_ActiveConfig.bShowEFBCopyRegions) - stats.efb_regions.push_back(rc); + stats.efb_regions.push_back(srcRect); - CopyEFB(bpmem.copyTexDest << 5, PE_copy.tp_realFormat(), - bpmem.zcontrol.pixel_format, rc, PE_copy.intensity_fmt, - PE_copy.half_scale); + CopyEFB(destAddr, srcRect, + PE_copy.tp_realFormat(), bpmem.zcontrol.pixel_format, + PE_copy.intensity_fmt, PE_copy.half_scale); } else { @@ -240,17 +242,18 @@ static void BPWritten(const BPCmd& bp) xfbLines = MAX_XFB_HEIGHT; } - Renderer::RenderToXFB(bpmem.copyTexDest << 5, - bpmem.copyMipMapStrideChannels << 4, - (u32)xfbLines, - rc, + u32 width = bpmem.copyMipMapStrideChannels << 4; + u32 height = xfbLines; + + Renderer::RenderToXFB(destAddr, srcRect, + width, height, s_gammaLUT[PE_copy.gamma]); } // Clear the rectangular region after copying it. if (PE_copy.clear) { - ClearScreen(rc); + ClearScreen(srcRect); } return; diff --git a/Source/Core/VideoCommon/RenderBase.cpp b/Source/Core/VideoCommon/RenderBase.cpp index 744557b54c..2c95cdf89d 100644 --- a/Source/Core/VideoCommon/RenderBase.cpp +++ b/Source/Core/VideoCommon/RenderBase.cpp @@ -102,7 +102,7 @@ Renderer::~Renderer() #endif } -void Renderer::RenderToXFB(u32 xfbAddr, u32 fbWidth, u32 fbHeight, const EFBRectangle& sourceRc, float Gamma) +void Renderer::RenderToXFB(u32 xfbAddr, const EFBRectangle& sourceRc, u32 fbWidth, u32 fbHeight, float Gamma) { CheckFifoRecording(); diff --git a/Source/Core/VideoCommon/RenderBase.h b/Source/Core/VideoCommon/RenderBase.h index 5ae0a677eb..16b17ae8de 100644 --- a/Source/Core/VideoCommon/RenderBase.h +++ b/Source/Core/VideoCommon/RenderBase.h @@ -97,7 +97,7 @@ public: virtual void ClearScreen(const EFBRectangle& rc, bool colorEnable, bool alphaEnable, bool zEnable, u32 color, u32 z) = 0; virtual void ReinterpretPixelData(unsigned int convtype) = 0; - static void RenderToXFB(u32 xfbAddr, u32 fbWidth, u32 fbHeight, const EFBRectangle& sourceRc,float Gamma = 1.0f); + static void RenderToXFB(u32 xfbAddr, const EFBRectangle& sourceRc, u32 fbWidth, u32 fbHeight, float Gamma = 1.0f); virtual u32 AccessEFB(EFBAccessType type, u32 x, u32 y, u32 poke_data) = 0;