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

Disable scissoring when blit internal buffers.

This commit is contained in:
Sergey Lipskiy 2016-05-14 18:15:54 +06:00
parent 88656c9059
commit 020144d6fd
2 changed files with 10 additions and 8 deletions

View File

@ -190,7 +190,6 @@ CachedTexture * DepthBuffer::resolveDepthBufferTexture(FrameBuffer * _pBuffer)
return m_pDepthBufferTexture; return m_pDepthBufferTexture;
if (m_resolved) if (m_resolved)
return m_pResolveDepthBufferTexture; return m_pResolveDepthBufferTexture;
glScissor(0, 0, m_pDepthBufferTexture->realWidth, m_pDepthBufferTexture->realHeight);
glBindFramebuffer(GL_READ_FRAMEBUFFER, _pBuffer->m_FBO); glBindFramebuffer(GL_READ_FRAMEBUFFER, _pBuffer->m_FBO);
glReadBuffer(GL_COLOR_ATTACHMENT0); glReadBuffer(GL_COLOR_ATTACHMENT0);
GLuint attachment = GL_COLOR_ATTACHMENT0; GLuint attachment = GL_COLOR_ATTACHMENT0;
@ -199,15 +198,16 @@ CachedTexture * DepthBuffer::resolveDepthBufferTexture(FrameBuffer * _pBuffer)
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, _pBuffer->m_resolveFBO); glBindFramebuffer(GL_DRAW_FRAMEBUFFER, _pBuffer->m_resolveFBO);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, m_pResolveDepthBufferTexture->glName, 0); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, m_pResolveDepthBufferTexture->glName, 0);
assert(checkFBO()); assert(checkFBO());
glDisable(GL_SCISSOR_TEST);
glBlitFramebuffer( glBlitFramebuffer(
0, 0, m_pDepthBufferTexture->realWidth, m_pDepthBufferTexture->realHeight, 0, 0, m_pDepthBufferTexture->realWidth, m_pDepthBufferTexture->realHeight,
0, 0, m_pResolveDepthBufferTexture->realWidth, m_pResolveDepthBufferTexture->realHeight, 0, 0, m_pResolveDepthBufferTexture->realWidth, m_pResolveDepthBufferTexture->realHeight,
GL_DEPTH_BUFFER_BIT, GL_NEAREST GL_DEPTH_BUFFER_BIT, GL_NEAREST
); );
glEnable(GL_SCISSOR_TEST);
glBindFramebuffer(GL_READ_FRAMEBUFFER, 0); glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, _pBuffer->m_FBO); glBindFramebuffer(GL_DRAW_FRAMEBUFFER, _pBuffer->m_FBO);
m_resolved = true; m_resolved = true;
gDP.changed |= CHANGED_SCISSOR;
return m_pResolveDepthBufferTexture; return m_pResolveDepthBufferTexture;
#else #else
return m_pDepthBufferTexture; return m_pDepthBufferTexture;
@ -225,7 +225,6 @@ CachedTexture * DepthBuffer::copyDepthBufferTexture(FrameBuffer * _pBuffer)
_initDepthBufferTexture(_pBuffer, m_pDepthBufferCopyTexture, false); _initDepthBufferTexture(_pBuffer, m_pDepthBufferCopyTexture, false);
} }
glScissor(0, 0, m_pDepthBufferTexture->realWidth, m_pDepthBufferTexture->realHeight);
glBindFramebuffer(GL_READ_FRAMEBUFFER, _pBuffer->m_FBO); glBindFramebuffer(GL_READ_FRAMEBUFFER, _pBuffer->m_FBO);
glReadBuffer(GL_COLOR_ATTACHMENT0); glReadBuffer(GL_COLOR_ATTACHMENT0);
assert(checkFBO()); assert(checkFBO());
@ -244,15 +243,16 @@ CachedTexture * DepthBuffer::copyDepthBufferTexture(FrameBuffer * _pBuffer)
0); 0);
glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, m_pDepthBufferCopyTexture->glName, 0); glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, m_pDepthBufferCopyTexture->glName, 0);
assert(checkFBO()); assert(checkFBO());
glDisable(GL_SCISSOR_TEST);
glBlitFramebuffer( glBlitFramebuffer(
0, 0, m_pDepthBufferTexture->realWidth, m_pDepthBufferTexture->realHeight, 0, 0, m_pDepthBufferTexture->realWidth, m_pDepthBufferTexture->realHeight,
0, 0, m_pDepthBufferTexture->realWidth, m_pDepthBufferTexture->realHeight, 0, 0, m_pDepthBufferTexture->realWidth, m_pDepthBufferTexture->realHeight,
GL_DEPTH_BUFFER_BIT, GL_NEAREST GL_DEPTH_BUFFER_BIT, GL_NEAREST
); );
glEnable(GL_SCISSOR_TEST);
glBindFramebuffer(GL_READ_FRAMEBUFFER, 0); glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, _pBuffer->m_FBO); glBindFramebuffer(GL_DRAW_FRAMEBUFFER, _pBuffer->m_FBO);
m_copied = true; m_copied = true;
gDP.changed |= CHANGED_SCISSOR;
return m_pDepthBufferCopyTexture; return m_pDepthBufferCopyTexture;
} }
#endif #endif

View File

@ -408,18 +408,18 @@ void FrameBuffer::resolveMultisampledTexture(bool _bForce)
#ifdef GL_MULTISAMPLING_SUPPORT #ifdef GL_MULTISAMPLING_SUPPORT
if (m_resolved && !_bForce) if (m_resolved && !_bForce)
return; return;
glScissor(0, 0, m_pTexture->realWidth, m_pTexture->realHeight);
glBindFramebuffer(GL_READ_FRAMEBUFFER, m_FBO); glBindFramebuffer(GL_READ_FRAMEBUFFER, m_FBO);
glReadBuffer(GL_COLOR_ATTACHMENT0); glReadBuffer(GL_COLOR_ATTACHMENT0);
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, m_resolveFBO); glBindFramebuffer(GL_DRAW_FRAMEBUFFER, m_resolveFBO);
glDisable(GL_SCISSOR_TEST);
glBlitFramebuffer( glBlitFramebuffer(
0, 0, m_pTexture->realWidth, m_pTexture->realHeight, 0, 0, m_pTexture->realWidth, m_pTexture->realHeight,
0, 0, m_pResolveTexture->realWidth, m_pResolveTexture->realHeight, 0, 0, m_pResolveTexture->realWidth, m_pResolveTexture->realHeight,
GL_COLOR_BUFFER_BIT, GL_NEAREST GL_COLOR_BUFFER_BIT, GL_NEAREST
); );
glEnable(GL_SCISSOR_TEST);
glBindFramebuffer(GL_READ_FRAMEBUFFER, 0); glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);
frameBufferList().setCurrentDrawBuffer(); frameBufferList().setCurrentDrawBuffer();
gDP.changed |= CHANGED_SCISSOR;
m_resolved = true; m_resolved = true;
#endif #endif
} }
@ -1230,7 +1230,6 @@ bool FrameBufferToRDRAM::_prepareCopy(u32 _startAddress)
if (m_pCurFrameBuffer->m_scaleX > 1.0f) { if (m_pCurFrameBuffer->m_scaleX > 1.0f) {
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, m_FBO); glBindFramebuffer(GL_DRAW_FRAMEBUFFER, m_FBO);
glScissor(0, 0, m_pCurFrameBuffer->m_pTexture->realWidth, m_pCurFrameBuffer->m_pTexture->realHeight);
u32 x0 = 0; u32 x0 = 0;
u32 width, height; u32 width, height;
if (config.frameBufferEmulation.nativeResFactor == 0) { if (config.frameBufferEmulation.nativeResFactor == 0) {
@ -1245,11 +1244,13 @@ bool FrameBufferToRDRAM::_prepareCopy(u32 _startAddress)
width = m_pCurFrameBuffer->m_pTexture->realWidth; width = m_pCurFrameBuffer->m_pTexture->realWidth;
height = m_pCurFrameBuffer->m_pTexture->realHeight; height = m_pCurFrameBuffer->m_pTexture->realHeight;
} }
glDisable(GL_SCISSOR_TEST);
glBlitFramebuffer( glBlitFramebuffer(
x0, 0, x0 + width, height, x0, 0, x0 + width, height,
0, 0, VI.width, VI.height, 0, 0, VI.width, VI.height,
GL_COLOR_BUFFER_BIT, GL_NEAREST GL_COLOR_BUFFER_BIT, GL_NEAREST
); );
glEnable(GL_SCISSOR_TEST);
glBindFramebuffer(GL_READ_FRAMEBUFFER, m_FBO); glBindFramebuffer(GL_READ_FRAMEBUFFER, m_FBO);
frameBufferList().setCurrentDrawBuffer(); frameBufferList().setCurrentDrawBuffer();
} }
@ -1539,12 +1540,13 @@ bool DepthBufferToRDRAM::_prepareCopy(u32 _address, bool _copyChunk)
glBindFramebuffer(GL_READ_FRAMEBUFFER, pBuffer->m_resolveFBO); glBindFramebuffer(GL_READ_FRAMEBUFFER, pBuffer->m_resolveFBO);
} }
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, m_FBO); glBindFramebuffer(GL_DRAW_FRAMEBUFFER, m_FBO);
glScissor(0, 0, pBuffer->m_pTexture->realWidth, pBuffer->m_pTexture->realHeight); glDisable(GL_SCISSOR_TEST);
glBlitFramebuffer( glBlitFramebuffer(
0, 0, pBuffer->m_pTexture->realWidth, pBuffer->m_pTexture->realHeight, 0, 0, pBuffer->m_pTexture->realWidth, pBuffer->m_pTexture->realHeight,
0, 0, pBuffer->m_width, pBuffer->m_height, 0, 0, pBuffer->m_width, pBuffer->m_height,
GL_DEPTH_BUFFER_BIT, GL_NEAREST GL_DEPTH_BUFFER_BIT, GL_NEAREST
); );
glEnable(GL_SCISSOR_TEST);
frameBufferList().setCurrentDrawBuffer(); frameBufferList().setCurrentDrawBuffer();
m_frameCount = curFrame; m_frameCount = curFrame;
return true; return true;