mirror of
https://github.com/blawar/GLideN64.git
synced 2024-07-07 03:13:49 +00:00
Fix rendering in widescreen resolutions when fb emulation disabled, #1700
This commit is contained in:
parent
210315ec46
commit
9b2f50ca67
|
@ -854,11 +854,16 @@ void FrameBufferList::_renderScreenSizeBuffer()
|
||||||
FrameBuffer * pFilteredBuffer = postProcessor.doGammaCorrection(postProcessor.doOrientationCorrection(pBuffer));
|
FrameBuffer * pFilteredBuffer = postProcessor.doGammaCorrection(postProcessor.doOrientationCorrection(pBuffer));
|
||||||
CachedTexture * pBufferTexture = pFilteredBuffer->m_pTexture;
|
CachedTexture * pBufferTexture = pFilteredBuffer->m_pTexture;
|
||||||
|
|
||||||
|
const u32 wndWidth = wnd.getWidth();
|
||||||
|
const u32 wndHeight = wnd.getHeight();
|
||||||
|
s32 srcCoord[4] = { 0, 0, static_cast<s32>(wndWidth), static_cast<s32>(wndHeight) };
|
||||||
|
|
||||||
s32 srcCoord[4] = { 0, 0, pBufferTexture->realWidth, pBufferTexture->realHeight };
|
const u32 screenWidth = wnd.getScreenWidth();
|
||||||
const s32 hOffset = (wnd.getScreenWidth() - wnd.getWidth()) / 2;
|
const u32 screenHeight = wnd.getScreenHeight();
|
||||||
const s32 vOffset = (wnd.getScreenHeight() - wnd.getHeight()) / 2 + wnd.getHeightOffset();
|
const u32 wndHeightOffset = wnd.getHeightOffset();
|
||||||
s32 dstCoord[4] = { hOffset, vOffset, hOffset + pBufferTexture->realWidth, vOffset + pBufferTexture->realHeight };
|
const s32 hOffset = (screenWidth - wndWidth) / 2;
|
||||||
|
const s32 vOffset = (screenHeight - wndHeight) / 2 + wndHeightOffset;
|
||||||
|
s32 dstCoord[4] = { hOffset, vOffset, hOffset + static_cast<s32>(wndWidth), vOffset + static_cast<s32>(wndHeight) };
|
||||||
|
|
||||||
gfxContext.bindFramebuffer(bufferTarget::DRAW_FRAMEBUFFER, ObjectHandle::null);
|
gfxContext.bindFramebuffer(bufferTarget::DRAW_FRAMEBUFFER, ObjectHandle::null);
|
||||||
|
|
||||||
|
@ -872,14 +877,14 @@ void FrameBufferList::_renderScreenSizeBuffer()
|
||||||
blitParams.srcY0 = srcCoord[3];
|
blitParams.srcY0 = srcCoord[3];
|
||||||
blitParams.srcX1 = srcCoord[2];
|
blitParams.srcX1 = srcCoord[2];
|
||||||
blitParams.srcY1 = srcCoord[1];
|
blitParams.srcY1 = srcCoord[1];
|
||||||
blitParams.srcWidth = pBufferTexture->realWidth;
|
blitParams.srcWidth = wndWidth;
|
||||||
blitParams.srcHeight = pBufferTexture->realHeight;
|
blitParams.srcHeight = wndHeight;
|
||||||
blitParams.dstX0 = dstCoord[0];
|
blitParams.dstX0 = dstCoord[0];
|
||||||
blitParams.dstY0 = dstCoord[1];
|
blitParams.dstY0 = dstCoord[1];
|
||||||
blitParams.dstX1 = dstCoord[2];
|
blitParams.dstX1 = dstCoord[2];
|
||||||
blitParams.dstY1 = dstCoord[3];
|
blitParams.dstY1 = dstCoord[3];
|
||||||
blitParams.dstWidth = wnd.getScreenWidth();
|
blitParams.dstWidth = screenWidth;
|
||||||
blitParams.dstHeight = wnd.getScreenHeight() + wnd.getHeightOffset();
|
blitParams.dstHeight = screenHeight + wndHeightOffset;
|
||||||
blitParams.filter = filter;
|
blitParams.filter = filter;
|
||||||
blitParams.mask = blitMask::COLOR_BUFFER;
|
blitParams.mask = blitMask::COLOR_BUFFER;
|
||||||
blitParams.tex[0] = pBufferTexture;
|
blitParams.tex[0] = pBufferTexture;
|
||||||
|
|
|
@ -258,19 +258,22 @@ void GraphicsDrawer::_updateViewport() const
|
||||||
void GraphicsDrawer::_updateScreenCoordsViewport() const
|
void GraphicsDrawer::_updateScreenCoordsViewport() const
|
||||||
{
|
{
|
||||||
DisplayWindow & wnd = DisplayWindow::get();
|
DisplayWindow & wnd = DisplayWindow::get();
|
||||||
FrameBuffer * pCurrentBuffer = frameBufferList().getCurrent();
|
const FrameBuffer * pCurrentBuffer = frameBufferList().getCurrent();
|
||||||
|
|
||||||
u32 bufferWidth;
|
u32 bufferWidth, bufferHeight;
|
||||||
f32 viewportScale;
|
f32 viewportScaleX, viewportScaleY;
|
||||||
if (pCurrentBuffer == nullptr) {
|
if (pCurrentBuffer == nullptr) {
|
||||||
bufferWidth = VI.width;
|
bufferWidth = VI.width;
|
||||||
viewportScale = wnd.getScaleX();
|
bufferHeight = VI.height;
|
||||||
|
viewportScaleX = wnd.getScaleX();
|
||||||
|
viewportScaleY = wnd.getScaleY();
|
||||||
} else {
|
} else {
|
||||||
bufferWidth = pCurrentBuffer->m_width;
|
bufferWidth = pCurrentBuffer->m_width;
|
||||||
viewportScale = pCurrentBuffer->m_scale;
|
bufferHeight = VI_GetMaxBufferHeight(bufferWidth);
|
||||||
|
viewportScaleX = viewportScaleY = pCurrentBuffer->m_scale;
|
||||||
}
|
}
|
||||||
const u32 bufferHeight = VI_GetMaxBufferHeight(bufferWidth);
|
|
||||||
gfxContext.setViewport(0, 0, (s32)(bufferWidth * viewportScale), (s32)(bufferHeight * viewportScale));
|
gfxContext.setViewport(0, 0, (s32)(bufferWidth * viewportScaleX), (s32)(bufferHeight * viewportScaleY));
|
||||||
gSP.changed |= CHANGED_VIEWPORT;
|
gSP.changed |= CHANGED_VIEWPORT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user