mirror of
https://github.com/blawar/GLideN64.git
synced 2024-07-04 10:03:36 +00:00
Fix _copyDepthBuffer().
Fixed LoT in Zelda MM
This commit is contained in:
parent
88acd219a0
commit
1715a8a3d0
|
@ -143,12 +143,12 @@ void DepthBuffer::_initDepthBufferTexture(FrameBuffer * _pBuffer, CachedTexture
|
|||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
}
|
||||
|
||||
void DepthBuffer::setDepthAttachment()
|
||||
void DepthBuffer::setDepthAttachment(GLenum _target)
|
||||
{
|
||||
if (config.video.multisampling != 0)
|
||||
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D_MULTISAMPLE, m_pDepthBufferTexture->glName, 0);
|
||||
glFramebufferTexture2D(_target, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D_MULTISAMPLE, m_pDepthBufferTexture->glName, 0);
|
||||
else
|
||||
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, m_pDepthBufferTexture->glName, 0);
|
||||
glFramebufferTexture2D(_target, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, m_pDepthBufferTexture->glName, 0);
|
||||
m_resolved = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ struct DepthBuffer
|
|||
void initDepthBufferTexture(FrameBuffer * _pBuffer);
|
||||
CachedTexture * resolveDepthBufferTexture(FrameBuffer * _pBuffer);
|
||||
|
||||
void setDepthAttachment();
|
||||
void setDepthAttachment(GLenum _target);
|
||||
void activateDepthBufferTexture(FrameBuffer * _pBuffer);
|
||||
|
||||
void bindDepthImageTexture();
|
||||
|
|
|
@ -457,7 +457,7 @@ void FrameBufferList::attachDepthBuffer()
|
|||
pDepthBuffer->initDepthImageTexture(m_pCurrent);
|
||||
pDepthBuffer->initDepthBufferTexture(m_pCurrent);
|
||||
m_pCurrent->m_pDepthBuffer = pDepthBuffer;
|
||||
pDepthBuffer->setDepthAttachment();
|
||||
pDepthBuffer->setDepthAttachment(GL_DRAW_FRAMEBUFFER);
|
||||
if (video().getRender().isImageTexturesSupported() && config.frameBufferEmulation.N64DepthCompare != 0)
|
||||
pDepthBuffer->bindDepthImageTexture();
|
||||
} else
|
||||
|
|
16
gSP.cpp
16
gSP.cpp
|
@ -2100,7 +2100,7 @@ void gSPObjRectangleR(u32 sp)
|
|||
gSPDrawObjRect(objCoords);
|
||||
}
|
||||
|
||||
#ifdef GL_IMAGE_TEXTURES_SUPPORT
|
||||
#ifndef GLES2
|
||||
static
|
||||
void _copyDepthBuffer()
|
||||
{
|
||||
|
@ -2115,14 +2115,11 @@ void _copyDepthBuffer()
|
|||
FrameBuffer * pTmpBuffer = frameBufferList().findTmpBuffer(frameBufferList().getCurrent()->m_startAddress);
|
||||
if (pTmpBuffer == NULL)
|
||||
return;
|
||||
DepthBuffer * pTmpBufferDepth = pTmpBuffer->m_pDepthBuffer;
|
||||
pTmpBuffer->m_pDepthBuffer = depthBufferList().findBuffer(gSP.bgImage.address);
|
||||
if (pTmpBufferDepth == NULL || pTmpBuffer->m_pDepthBuffer == NULL)
|
||||
DepthBuffer * pCopyBufferDepth = depthBufferList().findBuffer(gSP.bgImage.address);
|
||||
if (pCopyBufferDepth == NULL)
|
||||
return;
|
||||
glBindFramebuffer(GL_READ_FRAMEBUFFER, pTmpBuffer->m_FBO);
|
||||
pTmpBuffer->m_pDepthBuffer->setDepthAttachment();
|
||||
GLuint attachment = GL_COLOR_ATTACHMENT0;
|
||||
glDrawBuffers(1, &attachment);
|
||||
pCopyBufferDepth->setDepthAttachment(GL_READ_FRAMEBUFFER);
|
||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, frameBufferList().getCurrent()->m_FBO);
|
||||
OGLVideo & ogl = video();
|
||||
glBlitFramebuffer(
|
||||
|
@ -2131,12 +2128,13 @@ void _copyDepthBuffer()
|
|||
GL_DEPTH_BUFFER_BIT, GL_NEAREST
|
||||
);
|
||||
// Restore objects
|
||||
pTmpBufferDepth->setDepthAttachment();
|
||||
if (pTmpBuffer->m_pDepthBuffer != NULL)
|
||||
pTmpBuffer->m_pDepthBuffer->setDepthAttachment(GL_READ_FRAMEBUFFER);
|
||||
glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);
|
||||
// Set back current depth buffer
|
||||
depthBufferList().saveBuffer(gDP.depthImageAddress);
|
||||
}
|
||||
#endif // GL_IMAGE_TEXTURES_SUPPORT
|
||||
#endif // GLES2
|
||||
|
||||
static
|
||||
void _loadBGImage(const uObjScaleBg * _bgInfo, bool _loadScale)
|
||||
|
|
Loading…
Reference in New Issue
Block a user