From 52948bb3ef016abd7e35e775b17b7cf3f487d49c Mon Sep 17 00:00:00 2001 From: Scott Mansell Date: Tue, 1 Sep 2015 02:41:16 +1200 Subject: Cleanup and unify handling of efb copy stride. --- Source/Core/VideoCommon/BPStructs.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'Source/Core/VideoCommon/BPStructs.cpp') diff --git a/Source/Core/VideoCommon/BPStructs.cpp b/Source/Core/VideoCommon/BPStructs.cpp index 2717fe4b21..e30aa2fcaa 100644 --- a/Source/Core/VideoCommon/BPStructs.cpp +++ b/Source/Core/VideoCommon/BPStructs.cpp @@ -20,6 +20,7 @@ #include "VideoCommon/PixelShaderManager.h" #include "VideoCommon/RenderBase.h" #include "VideoCommon/Statistics.h" +#include "VideoCommon/TextureCacheBase.h" #include "VideoCommon/TextureDecoder.h" #include "VideoCommon/VertexShaderManager.h" #include "VideoCommon/VideoCommon.h" @@ -205,6 +206,7 @@ static void BPWritten(const BPCmd& bp) // The values in bpmem.copyTexSrcXY and bpmem.copyTexSrcWH are updated in case 0x49 and 0x4a in this function u32 destAddr = bpmem.copyTexDest << 5; + u32 destStride = bpmem.copyMipMapStrideChannels << 5; EFBRectangle srcRect; srcRect.left = (int)bpmem.copyTexSrcXY.x; @@ -223,8 +225,9 @@ static void BPWritten(const BPCmd& bp) if (g_ActiveConfig.bShowEFBCopyRegions) stats.efb_regions.push_back(srcRect); - CopyEFB(destAddr, srcRect, - PE_copy.tp_realFormat(), bpmem.zcontrol.pixel_format, + // bpmem.zcontrol.pixel_format to PEControl::Z24 is when the game wants to copy from ZBuffer (Zbuffer uses 24-bit Format) + TextureCache::CopyRenderTargetToTexture(destAddr, PE_copy.tp_realFormat(), destStride, + bpmem.zcontrol.pixel_format, srcRect, !!PE_copy.intensity_fmt, !!PE_copy.half_scale); } else @@ -251,10 +254,9 @@ static void BPWritten(const BPCmd& bp) height = MAX_XFB_HEIGHT; } - u32 stride = bpmem.copyMipMapStrideChannels << 5; DEBUG_LOG(VIDEO, "RenderToXFB: destAddr: %08x | srcRect {%d %d %d %d} | fbWidth: %u | fbStride: %u | fbHeight: %u", - destAddr, srcRect.left, srcRect.top, srcRect.right, srcRect.bottom, bpmem.copyTexSrcWH.x + 1, stride, height); - Renderer::RenderToXFB(destAddr, srcRect, stride, height, s_gammaLUT[PE_copy.gamma]); + destAddr, srcRect.left, srcRect.top, srcRect.right, srcRect.bottom, bpmem.copyTexSrcWH.x + 1, destStride, height); + Renderer::RenderToXFB(destAddr, srcRect, destStride, height, s_gammaLUT[PE_copy.gamma]); } // Clear the rectangular region after copying it. -- cgit v1.2.3