mirror of
https://github.com/blawar/GLideN64.git
synced 2024-07-07 03:13:49 +00:00
Code refactor in _copyDepthBuffer().
This commit is contained in:
parent
bff19580eb
commit
27c4cccd81
12
src/gSP.cpp
12
src/gSP.cpp
|
@ -2058,17 +2058,19 @@ void _copyDepthBuffer()
|
||||||
// OpenGL has different format for color and depth buffers, so this trick can't be performed directly
|
// OpenGL has different format for color and depth buffers, so this trick can't be performed directly
|
||||||
// To do that, depth buffer with address of current color buffer created and attached to the current FBO
|
// To do that, depth buffer with address of current color buffer created and attached to the current FBO
|
||||||
// It will be copy depth buffer
|
// It will be copy depth buffer
|
||||||
depthBufferList().saveBuffer(gDP.colorImage.address);
|
DepthBufferList & dbList = depthBufferList();
|
||||||
|
dbList.saveBuffer(gDP.colorImage.address);
|
||||||
// Take any frame buffer and attach source depth buffer to it, to blit it into copy depth buffer
|
// Take any frame buffer and attach source depth buffer to it, to blit it into copy depth buffer
|
||||||
FrameBuffer * pTmpBuffer = frameBufferList().findTmpBuffer(frameBufferList().getCurrent()->m_startAddress);
|
FrameBufferList & fbList = frameBufferList();
|
||||||
|
FrameBuffer * pTmpBuffer = fbList.findTmpBuffer(fbList.getCurrent()->m_startAddress);
|
||||||
if (pTmpBuffer == NULL)
|
if (pTmpBuffer == NULL)
|
||||||
return;
|
return;
|
||||||
DepthBuffer * pCopyBufferDepth = depthBufferList().findBuffer(gSP.bgImage.address);
|
DepthBuffer * pCopyBufferDepth = dbList.findBuffer(gSP.bgImage.address);
|
||||||
if (pCopyBufferDepth == NULL)
|
if (pCopyBufferDepth == NULL)
|
||||||
return;
|
return;
|
||||||
glBindFramebuffer(GL_READ_FRAMEBUFFER, pTmpBuffer->m_FBO);
|
glBindFramebuffer(GL_READ_FRAMEBUFFER, pTmpBuffer->m_FBO);
|
||||||
pCopyBufferDepth->setDepthAttachment(GL_READ_FRAMEBUFFER);
|
pCopyBufferDepth->setDepthAttachment(GL_READ_FRAMEBUFFER);
|
||||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, frameBufferList().getCurrent()->m_FBO);
|
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fbList.getCurrent()->m_FBO);
|
||||||
OGLVideo & ogl = video();
|
OGLVideo & ogl = video();
|
||||||
glBlitFramebuffer(
|
glBlitFramebuffer(
|
||||||
0, 0, ogl.getWidth(), ogl.getHeight(),
|
0, 0, ogl.getWidth(), ogl.getHeight(),
|
||||||
|
@ -2080,7 +2082,7 @@ void _copyDepthBuffer()
|
||||||
pTmpBuffer->m_pDepthBuffer->setDepthAttachment(GL_READ_FRAMEBUFFER);
|
pTmpBuffer->m_pDepthBuffer->setDepthAttachment(GL_READ_FRAMEBUFFER);
|
||||||
glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);
|
glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);
|
||||||
// Set back current depth buffer
|
// Set back current depth buffer
|
||||||
depthBufferList().saveBuffer(gDP.depthImageAddress);
|
dbList.saveBuffer(gDP.depthImageAddress);
|
||||||
}
|
}
|
||||||
#endif // GLES2
|
#endif // GLES2
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user