mirror of
https://github.com/blawar/GLideN64.git
synced 2024-07-07 03:13:49 +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);
|
glBindTexture(GL_TEXTURE_2D, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DepthBuffer::setDepthAttachment()
|
void DepthBuffer::setDepthAttachment(GLenum _target)
|
||||||
{
|
{
|
||||||
if (config.video.multisampling != 0)
|
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
|
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;
|
m_resolved = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ struct DepthBuffer
|
||||||
void initDepthBufferTexture(FrameBuffer * _pBuffer);
|
void initDepthBufferTexture(FrameBuffer * _pBuffer);
|
||||||
CachedTexture * resolveDepthBufferTexture(FrameBuffer * _pBuffer);
|
CachedTexture * resolveDepthBufferTexture(FrameBuffer * _pBuffer);
|
||||||
|
|
||||||
void setDepthAttachment();
|
void setDepthAttachment(GLenum _target);
|
||||||
void activateDepthBufferTexture(FrameBuffer * _pBuffer);
|
void activateDepthBufferTexture(FrameBuffer * _pBuffer);
|
||||||
|
|
||||||
void bindDepthImageTexture();
|
void bindDepthImageTexture();
|
||||||
|
|
|
@ -457,7 +457,7 @@ void FrameBufferList::attachDepthBuffer()
|
||||||
pDepthBuffer->initDepthImageTexture(m_pCurrent);
|
pDepthBuffer->initDepthImageTexture(m_pCurrent);
|
||||||
pDepthBuffer->initDepthBufferTexture(m_pCurrent);
|
pDepthBuffer->initDepthBufferTexture(m_pCurrent);
|
||||||
m_pCurrent->m_pDepthBuffer = pDepthBuffer;
|
m_pCurrent->m_pDepthBuffer = pDepthBuffer;
|
||||||
pDepthBuffer->setDepthAttachment();
|
pDepthBuffer->setDepthAttachment(GL_DRAW_FRAMEBUFFER);
|
||||||
if (video().getRender().isImageTexturesSupported() && config.frameBufferEmulation.N64DepthCompare != 0)
|
if (video().getRender().isImageTexturesSupported() && config.frameBufferEmulation.N64DepthCompare != 0)
|
||||||
pDepthBuffer->bindDepthImageTexture();
|
pDepthBuffer->bindDepthImageTexture();
|
||||||
} else
|
} else
|
||||||
|
|
16
gSP.cpp
16
gSP.cpp
|
@ -2100,7 +2100,7 @@ void gSPObjRectangleR(u32 sp)
|
||||||
gSPDrawObjRect(objCoords);
|
gSPDrawObjRect(objCoords);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef GL_IMAGE_TEXTURES_SUPPORT
|
#ifndef GLES2
|
||||||
static
|
static
|
||||||
void _copyDepthBuffer()
|
void _copyDepthBuffer()
|
||||||
{
|
{
|
||||||
|
@ -2115,14 +2115,11 @@ void _copyDepthBuffer()
|
||||||
FrameBuffer * pTmpBuffer = frameBufferList().findTmpBuffer(frameBufferList().getCurrent()->m_startAddress);
|
FrameBuffer * pTmpBuffer = frameBufferList().findTmpBuffer(frameBufferList().getCurrent()->m_startAddress);
|
||||||
if (pTmpBuffer == NULL)
|
if (pTmpBuffer == NULL)
|
||||||
return;
|
return;
|
||||||
DepthBuffer * pTmpBufferDepth = pTmpBuffer->m_pDepthBuffer;
|
DepthBuffer * pCopyBufferDepth = depthBufferList().findBuffer(gSP.bgImage.address);
|
||||||
pTmpBuffer->m_pDepthBuffer = depthBufferList().findBuffer(gSP.bgImage.address);
|
if (pCopyBufferDepth == NULL)
|
||||||
if (pTmpBufferDepth == NULL || pTmpBuffer->m_pDepthBuffer == NULL)
|
|
||||||
return;
|
return;
|
||||||
glBindFramebuffer(GL_READ_FRAMEBUFFER, pTmpBuffer->m_FBO);
|
glBindFramebuffer(GL_READ_FRAMEBUFFER, pTmpBuffer->m_FBO);
|
||||||
pTmpBuffer->m_pDepthBuffer->setDepthAttachment();
|
pCopyBufferDepth->setDepthAttachment(GL_READ_FRAMEBUFFER);
|
||||||
GLuint attachment = GL_COLOR_ATTACHMENT0;
|
|
||||||
glDrawBuffers(1, &attachment);
|
|
||||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, frameBufferList().getCurrent()->m_FBO);
|
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, frameBufferList().getCurrent()->m_FBO);
|
||||||
OGLVideo & ogl = video();
|
OGLVideo & ogl = video();
|
||||||
glBlitFramebuffer(
|
glBlitFramebuffer(
|
||||||
|
@ -2131,12 +2128,13 @@ void _copyDepthBuffer()
|
||||||
GL_DEPTH_BUFFER_BIT, GL_NEAREST
|
GL_DEPTH_BUFFER_BIT, GL_NEAREST
|
||||||
);
|
);
|
||||||
// Restore objects
|
// Restore objects
|
||||||
pTmpBufferDepth->setDepthAttachment();
|
if (pTmpBuffer->m_pDepthBuffer != NULL)
|
||||||
|
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);
|
depthBufferList().saveBuffer(gDP.depthImageAddress);
|
||||||
}
|
}
|
||||||
#endif // GL_IMAGE_TEXTURES_SUPPORT
|
#endif // GLES2
|
||||||
|
|
||||||
static
|
static
|
||||||
void _loadBGImage(const uObjScaleBg * _bgInfo, bool _loadScale)
|
void _loadBGImage(const uObjScaleBg * _bgInfo, bool _loadScale)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user