From 15611a77314c09d5ceda570cf5181bfd73665314 Mon Sep 17 00:00:00 2001 From: purplemarshmallow Date: Sat, 31 Oct 2015 03:36:16 +0100 Subject: [PATCH] Copy auxiliary buffers at fullsync Do not use fingerprint --- src/FrameBuffer.cpp | 25 ++++++++++++++++++++++++- src/FrameBuffer.h | 2 ++ src/gDP.cpp | 5 +++++ 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/src/FrameBuffer.cpp b/src/FrameBuffer.cpp index 1c7ec9ca..58c688fd 100644 --- a/src/FrameBuffer.cpp +++ b/src/FrameBuffer.cpp @@ -268,7 +268,7 @@ void FrameBuffer::copyRdram() const u32 dataSize = stride * height; // Auxiliary frame buffer - if (m_width != VI.width) { + if (m_width != VI.width && config.frameBufferEmulation.copyAuxToRDRAM == 0) { // Write small amount of data to the start of the buffer. // This is necessary for auxilary buffers: game can restore content of RDRAM when buffer is not needed anymore // Thus content of RDRAM on moment of buffer creation will be the same as when buffer becomes obsolete. @@ -538,6 +538,29 @@ void FrameBufferList::saveBuffer(u32 _address, u16 _format, u16 _size, u16 _widt m_pCurrent->m_postProcessed = false; } +void FrameBufferList::copyAux() +{ + for (FrameBuffers::iterator iter = m_list.begin(); iter != m_list.end(); ++iter) { + if (iter->m_width != VI.width && iter->m_height != VI.height) + FrameBuffer_CopyToRDRAM(iter->m_startAddress); + } +} + +void FrameBufferList::removeAux() +{ + for (FrameBuffers::iterator iter = m_list.begin(); iter != m_list.end(); ++iter) { + while (iter->m_width != VI.width && iter->m_height != VI.height) { + if (&(*iter) == m_pCurrent) { + m_pCurrent = NULL; + glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); + } + iter = m_list.erase(iter); + if (iter == m_list.end()) + return; + } + } +} + void FrameBufferList::removeBuffer(u32 _address ) { for (FrameBuffers::iterator iter = m_list.begin(); iter != m_list.end(); ++iter) diff --git a/src/FrameBuffer.h b/src/FrameBuffer.h index e931ed94..bab73c77 100644 --- a/src/FrameBuffer.h +++ b/src/FrameBuffer.h @@ -60,6 +60,8 @@ public: void init(); void destroy(); void saveBuffer(u32 _address, u16 _format, u16 _size, u16 _width, u16 _height, bool _cfb); + void removeAux(); + void copyAux(); void removeBuffer(u32 _address); void removeBuffers(u32 _width); void attachDepthBuffer(); diff --git a/src/gDP.cpp b/src/gDP.cpp index af896511..65eeb186 100644 --- a/src/gDP.cpp +++ b/src/gDP.cpp @@ -882,6 +882,11 @@ void gDPTextureRectangleFlip( f32 ulx, f32 uly, f32 lrx, f32 lry, s32 tile, f32 void gDPFullSync() { + if (config.frameBufferEmulation.copyAuxToRDRAM != 0) { + frameBufferList().copyAux(); + frameBufferList().removeAux(); + } + if (RSP.bLLE) { if (config.frameBufferEmulation.copyToRDRAM != Config::ctDisable) FrameBuffer_CopyToRDRAM(gDP.colorImage.address);