From f7b669a740283924e5012d61a52faf3a72a0057a Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Wed, 10 Sep 2014 23:58:07 -0700 Subject: [PATCH] Fix infinite recursion in framebuf create upload. Needs to be done *after* currentRenderVfb_ is set. Fixes #6872. --- GPU/Common/FramebufferCommon.cpp | 14 ++++++-------- GPU/Directx9/FramebufferDX9.cpp | 9 --------- GPU/GLES/GLES_GPU.cpp | 4 ++-- 3 files changed, 8 insertions(+), 19 deletions(-) diff --git a/GPU/Common/FramebufferCommon.cpp b/GPU/Common/FramebufferCommon.cpp index a5402b0eed..a5a7d81fc3 100644 --- a/GPU/Common/FramebufferCommon.cpp +++ b/GPU/Common/FramebufferCommon.cpp @@ -310,14 +310,6 @@ void FramebufferManagerCommon::DoSetRenderFrameBuffer() { ResizeFramebufFBO(vfb, drawing_width, drawing_height, true); NotifyRenderFramebufferCreated(vfb); - if (useBufferedRendering_ && !updateVRAM_ && !g_Config.bDisableSlowFramebufEffects) { - u32 byteSize = FramebufferByteSize(vfb); - u32 fb_address_mem = (vfb->fb_address & 0x3FFFFFFF) | 0x04000000; - gpu->PerformMemoryUpload(fb_address_mem, byteSize); - NotifyStencilUpload(fb_address_mem, byteSize, true); - // TODO: Is it worth trying to upload the depth buffer? - } - INFO_LOG(SCEGE, "Creating FBO for %08x : %i x %i x %i", vfb->fb_address, vfb->width, vfb->height, vfb->format); vfb->last_frame_render = gpuStats.numFlips; @@ -327,6 +319,12 @@ void FramebufferManagerCommon::DoSetRenderFrameBuffer() { vfbs_.push_back(vfb); currentRenderVfb_ = vfb; + if (useBufferedRendering_ && !updateVRAM_ && !g_Config.bDisableSlowFramebufEffects) { + gpu->PerformMemoryUpload(fb_address_mem, byteSize); + NotifyStencilUpload(fb_address_mem, byteSize, true); + // TODO: Is it worth trying to upload the depth buffer? + } + // Let's check for depth buffer overlap. Might be interesting. bool sharingReported = false; bool writingDepth = true; diff --git a/GPU/Directx9/FramebufferDX9.cpp b/GPU/Directx9/FramebufferDX9.cpp index e4bd0948d5..1713f99c47 100644 --- a/GPU/Directx9/FramebufferDX9.cpp +++ b/GPU/Directx9/FramebufferDX9.cpp @@ -393,15 +393,6 @@ namespace DX9 { ClearBuffer(); - // TODO (in Common) - //if (useBufferedRendering_ && !updateVRAM_ && !g_Config.bDisableSlowFramebufEffects) { - // u32 byteSize = FramebufferByteSize(vfb); - // u32 fb_address_mem = (vfb->fb_address & 0x3FFFFFFF) | 0x04000000; - // gpu->PerformMemoryUpload(fb_address_mem, byteSize); - // NotifyStencilUpload(fb_address_mem, byteSize, true); - // // TODO: Is it worth trying to upload the depth buffer? - //} - // ugly... if (gstate_c.curRTWidth != vfb->width || gstate_c.curRTHeight != vfb->height) { shaderManager_->DirtyUniform(DIRTY_PROJTHROUGHMATRIX); diff --git a/GPU/GLES/GLES_GPU.cpp b/GPU/GLES/GLES_GPU.cpp index b8bfea374d..0e7a906933 100644 --- a/GPU/GLES/GLES_GPU.cpp +++ b/GPU/GLES/GLES_GPU.cpp @@ -2104,7 +2104,7 @@ bool GLES_GPU::PerformMemoryDownload(u32 dest, int size) { // Cheat a bit to force a download of the framebuffer. // VRAM + 0x00400000 is simply a VRAM mirror. if (Memory::IsVRAMAddress(dest)) { - return gpu->PerformMemoryCopy(dest ^ 0x00400000, dest, size); + return PerformMemoryCopy(dest ^ 0x00400000, dest, size); } return false; } @@ -2113,7 +2113,7 @@ bool GLES_GPU::PerformMemoryUpload(u32 dest, int size) { // Cheat a bit to force an upload of the framebuffer. // VRAM + 0x00400000 is simply a VRAM mirror. if (Memory::IsVRAMAddress(dest)) { - return gpu->PerformMemoryCopy(dest, dest ^ 0x00400000, size); + return PerformMemoryCopy(dest, dest ^ 0x00400000, size); } return false; }