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

Correct chained buffers detection in FrameBufferList::renderBuffer()

This commit is contained in:
Sergey Lipskiy 2017-03-13 21:45:21 +07:00
parent cd9567b728
commit 21d64691cf

View File

@ -1031,10 +1031,13 @@ void FrameBufferList::renderBuffer()
srcWidth = min(rdpRes.vi_width, (rdpRes.vi_hres * rdpRes.vi_x_add) >> 10);
srcHeight = rdpRes.vi_width * ((rdpRes.vi_vres*rdpRes.vi_y_add + rdpRes.vi_y_start) >> 10) / pBuffer->m_width;
u32 maxY = gDP.scissor.uly + gDP.scissor.lry;
if (maxY == 0)
maxY = vFullHeight;
if (srcY0 + srcHeight > maxY) {
const u32 stride = pBuffer->m_width << pBuffer->m_size >> 1;
FrameBuffer *pNextBuffer = findBuffer(rdpRes.vi_origin + stride * srcHeight);
if (pNextBuffer == pBuffer)
pNextBuffer = nullptr;
if (pNextBuffer != nullptr) {
dstPartHeight = srcY0;
// srcY0 = (s32)(srcY0*yScale);
srcPartHeight = srcY0;
@ -1121,12 +1124,10 @@ void FrameBufferList::renderBuffer()
drawer.copyTexturedRect(blitParams);
if (dstPartHeight > 0) {
const u32 size = *REG.VI_STATUS & 3;
pBuffer = findBuffer(rdpRes.vi_origin + (((*REG.VI_WIDTH)*VI.height) << size >> 1));
if (pBuffer != nullptr) {
if (pNextBuffer != nullptr) {
pNextBuffer->m_isMainBuffer = true;
pFilteredBuffer = postProcessor.doBlur(postProcessor.doGammaCorrection(
postProcessor.doOrientationCorrection(pBuffer)));
postProcessor.doOrientationCorrection(pNextBuffer)));
srcY1 = srcPartHeight;
dstY0 = dstY1;
dstY1 = dstY0 + dstPartHeight;
@ -1134,7 +1135,8 @@ void FrameBufferList::renderBuffer()
pFilteredBuffer->resolveMultisampledTexture();
readBuffer = pFilteredBuffer->m_resolveFBO;
pBufferTexture = pFilteredBuffer->m_pResolveTexture;
} else {
}
else {
readBuffer = pFilteredBuffer->m_FBO;
pBufferTexture = pFilteredBuffer->m_pTexture;
}
@ -1154,7 +1156,6 @@ void FrameBufferList::renderBuffer()
drawer.copyTexturedRect(blitParams);
}
}
gfxContext.bindFramebuffer(bufferTarget::READ_FRAMEBUFFER, ObjectHandle::null);