1
0
mirror of https://github.com/blawar/GLideN64.git synced 2024-07-07 03:13:49 +00:00

Fix usage of FrameBufferToRDRAM::m_frameCount

This commit is contained in:
Sergey Lipskiy 2015-11-30 00:30:50 +06:00
parent 05d6972cc3
commit 1e376d641b

View File

@ -28,7 +28,7 @@ public:
m_pTexture(nullptr), m_pTexture(nullptr),
m_pCurFrameBuffer(nullptr), m_pCurFrameBuffer(nullptr),
m_curIndex(-1), m_curIndex(-1),
m_frameCount(0) m_frameCount(-1)
{ {
m_PBO[0] = m_PBO[1] = m_PBO[2] = 0; m_PBO[0] = m_PBO[1] = m_PBO[2] = 0;
} }
@ -1044,6 +1044,10 @@ void FrameBufferToRDRAM::Destroy() {
bool FrameBufferToRDRAM::_prepareCopy(u32 _address) bool FrameBufferToRDRAM::_prepareCopy(u32 _address)
{ {
const u32 curFrame = video().getBuffersSwapCount();
if (m_frameCount == curFrame)
return true;
if (VI.width == 0 || frameBufferList().getCurrent() == NULL) if (VI.width == 0 || frameBufferList().getCurrent() == NULL)
return false; return false;
@ -1085,6 +1089,7 @@ bool FrameBufferToRDRAM::_prepareCopy(u32 _address)
glBindFramebuffer(GL_READ_FRAMEBUFFER, m_FBO); glBindFramebuffer(GL_READ_FRAMEBUFFER, m_FBO);
} }
m_frameCount = curFrame;
return true; return true;
} }
@ -1215,7 +1220,6 @@ void FrameBufferToRDRAM::_copy(u32 _startAddress, u32 _endAddress, bool _sync)
#else #else
free(pixelData); free(pixelData);
#endif #endif
glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);
gDP.changed |= CHANGED_SCISSOR; gDP.changed |= CHANGED_SCISSOR;
} }
@ -1422,7 +1426,6 @@ bool DepthBufferToRDRAM::_copy(u32 _startAddress, u32 _endAddress)
pBuffer->m_cleared = false; pBuffer->m_cleared = false;
glUnmapBuffer(GL_PIXEL_PACK_BUFFER); glUnmapBuffer(GL_PIXEL_PACK_BUFFER);
glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);
gDP.changed |= CHANGED_SCISSOR; gDP.changed |= CHANGED_SCISSOR;
return true; return true;
} }