mirror of
https://github.com/blawar/GLideN64.git
synced 2024-07-07 03:13:49 +00:00
Correct chained buffers detection in FrameBufferList::renderBuffer()
This commit is contained in:
parent
cd9567b728
commit
21d64691cf
|
@ -1031,10 +1031,13 @@ void FrameBufferList::renderBuffer()
|
||||||
srcWidth = min(rdpRes.vi_width, (rdpRes.vi_hres * rdpRes.vi_x_add) >> 10);
|
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;
|
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)
|
const u32 stride = pBuffer->m_width << pBuffer->m_size >> 1;
|
||||||
maxY = vFullHeight;
|
FrameBuffer *pNextBuffer = findBuffer(rdpRes.vi_origin + stride * srcHeight);
|
||||||
if (srcY0 + srcHeight > maxY) {
|
if (pNextBuffer == pBuffer)
|
||||||
|
pNextBuffer = nullptr;
|
||||||
|
|
||||||
|
if (pNextBuffer != nullptr) {
|
||||||
dstPartHeight = srcY0;
|
dstPartHeight = srcY0;
|
||||||
// srcY0 = (s32)(srcY0*yScale);
|
// srcY0 = (s32)(srcY0*yScale);
|
||||||
srcPartHeight = srcY0;
|
srcPartHeight = srcY0;
|
||||||
|
@ -1121,39 +1124,37 @@ void FrameBufferList::renderBuffer()
|
||||||
|
|
||||||
drawer.copyTexturedRect(blitParams);
|
drawer.copyTexturedRect(blitParams);
|
||||||
|
|
||||||
if (dstPartHeight > 0) {
|
if (pNextBuffer != nullptr) {
|
||||||
const u32 size = *REG.VI_STATUS & 3;
|
pNextBuffer->m_isMainBuffer = true;
|
||||||
pBuffer = findBuffer(rdpRes.vi_origin + (((*REG.VI_WIDTH)*VI.height) << size >> 1));
|
pFilteredBuffer = postProcessor.doBlur(postProcessor.doGammaCorrection(
|
||||||
if (pBuffer != nullptr) {
|
postProcessor.doOrientationCorrection(pNextBuffer)));
|
||||||
pFilteredBuffer = postProcessor.doBlur(postProcessor.doGammaCorrection(
|
srcY1 = srcPartHeight;
|
||||||
postProcessor.doOrientationCorrection(pBuffer)));
|
dstY0 = dstY1;
|
||||||
srcY1 = srcPartHeight;
|
dstY1 = dstY0 + dstPartHeight;
|
||||||
dstY0 = dstY1;
|
if (pFilteredBuffer->m_pTexture->frameBufferTexture == CachedTexture::fbMultiSample) {
|
||||||
dstY1 = dstY0 + dstPartHeight;
|
pFilteredBuffer->resolveMultisampledTexture();
|
||||||
if (pFilteredBuffer->m_pTexture->frameBufferTexture == CachedTexture::fbMultiSample) {
|
readBuffer = pFilteredBuffer->m_resolveFBO;
|
||||||
pFilteredBuffer->resolveMultisampledTexture();
|
pBufferTexture = pFilteredBuffer->m_pResolveTexture;
|
||||||
readBuffer = pFilteredBuffer->m_resolveFBO;
|
|
||||||
pBufferTexture = pFilteredBuffer->m_pResolveTexture;
|
|
||||||
} else {
|
|
||||||
readBuffer = pFilteredBuffer->m_FBO;
|
|
||||||
pBufferTexture = pFilteredBuffer->m_pTexture;
|
|
||||||
}
|
|
||||||
|
|
||||||
blitParams.srcY0 = 0;
|
|
||||||
blitParams.srcY1 = min((s32)(srcY1*srcScaleY), (s32)pFilteredBuffer->m_pTexture->realHeight);
|
|
||||||
blitParams.srcWidth = pBufferTexture->realWidth;
|
|
||||||
blitParams.srcHeight = pBufferTexture->realHeight;
|
|
||||||
blitParams.dstX0 = hOffset;
|
|
||||||
blitParams.dstY0 = vOffset + (s32)(dstY0*dstScaleY);
|
|
||||||
blitParams.dstX1 = hOffset + dstX1;
|
|
||||||
blitParams.dstY1 = vOffset + (s32)(dstY1*dstScaleY);
|
|
||||||
blitParams.dstWidth = wnd.getScreenWidth();
|
|
||||||
blitParams.dstHeight = wnd.getScreenHeight() + wnd.getHeightOffset();
|
|
||||||
blitParams.tex[0] = pBufferTexture;
|
|
||||||
blitParams.readBuffer = readBuffer;
|
|
||||||
|
|
||||||
drawer.copyTexturedRect(blitParams);
|
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
readBuffer = pFilteredBuffer->m_FBO;
|
||||||
|
pBufferTexture = pFilteredBuffer->m_pTexture;
|
||||||
|
}
|
||||||
|
|
||||||
|
blitParams.srcY0 = 0;
|
||||||
|
blitParams.srcY1 = min((s32)(srcY1*srcScaleY), (s32)pFilteredBuffer->m_pTexture->realHeight);
|
||||||
|
blitParams.srcWidth = pBufferTexture->realWidth;
|
||||||
|
blitParams.srcHeight = pBufferTexture->realHeight;
|
||||||
|
blitParams.dstX0 = hOffset;
|
||||||
|
blitParams.dstY0 = vOffset + (s32)(dstY0*dstScaleY);
|
||||||
|
blitParams.dstX1 = hOffset + dstX1;
|
||||||
|
blitParams.dstY1 = vOffset + (s32)(dstY1*dstScaleY);
|
||||||
|
blitParams.dstWidth = wnd.getScreenWidth();
|
||||||
|
blitParams.dstHeight = wnd.getScreenHeight() + wnd.getHeightOffset();
|
||||||
|
blitParams.tex[0] = pBufferTexture;
|
||||||
|
blitParams.readBuffer = readBuffer;
|
||||||
|
|
||||||
|
drawer.copyTexturedRect(blitParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
gfxContext.bindFramebuffer(bufferTarget::READ_FRAMEBUFFER, ObjectHandle::null);
|
gfxContext.bindFramebuffer(bufferTarget::READ_FRAMEBUFFER, ObjectHandle::null);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user