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

Fix GL Errors in Pokemon Stadium 2 minigames.

Graphics became corrupt when the GL errors happened. With this change,
graphics no longer become corrupt.
This commit is contained in:
Francisco Zurita 2016-11-02 00:13:50 -04:00 committed by Sergey Lipskiy
parent 617517737d
commit 472c31986c

View File

@ -387,7 +387,7 @@ void DepthBufferList::saveBuffer(u32 _address)
pDepthBuffer = nullptr; pDepthBuffer = nullptr;
} }
if (pDepthBuffer == nullptr) { if (pDepthBuffer == nullptr && VI.height != 0) {
m_list.emplace_front(); m_list.emplace_front();
DepthBuffer & buffer = m_list.front(); DepthBuffer & buffer = m_list.front();
@ -399,18 +399,20 @@ void DepthBufferList::saveBuffer(u32 _address)
pDepthBuffer = &buffer; pDepthBuffer = &buffer;
} }
DepthBuffer * pCurrent = m_pCurrent; //Check for null since the depth buffer will not be initialized if VI.height == 0
m_pCurrent = pDepthBuffer; if(pDepthBuffer != nullptr) {
frameBufferList().attachDepthBuffer(); DepthBuffer * pCurrent = m_pCurrent;
if (pDepthBuffer->m_address != gDP.depthImageAddress) m_pCurrent = pDepthBuffer;
m_pCurrent = pCurrent; frameBufferList().attachDepthBuffer();
if (pDepthBuffer->m_address != gDP.depthImageAddress)
m_pCurrent = pCurrent;
}
#ifdef DEBUG #ifdef DEBUG
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED, "DepthBuffer_SetBuffer( 0x%08X ); color buffer is 0x%08X\n", DebugMsg( DEBUG_HIGH | DEBUG_HANDLED, "DepthBuffer_SetBuffer( 0x%08X ); color buffer is 0x%08X\n",
address, ( pFrameBuffer != nullptr && pFrameBuffer->m_FBO > 0) ? pFrameBuffer->m_startAddress : 0 address, ( pFrameBuffer != nullptr && pFrameBuffer->m_FBO > 0) ? pFrameBuffer->m_startAddress : 0
); );
#endif #endif
} }
void DepthBufferList::clearBuffer(u32 _ulx, u32 _uly, u32 _lrx, u32 _lry) void DepthBufferList::clearBuffer(u32 _ulx, u32 _uly, u32 _lrx, u32 _lry)