mirror of
https://github.com/blawar/GLideN64.git
synced 2024-06-30 08:24:05 +00:00
Bind to the current frame buffer FBO when copying auxiliary buffers to
RDRAM
This commit is contained in:
parent
6ee8c71bf0
commit
f5e73a8081
|
@ -22,8 +22,6 @@ using namespace graphics;
|
|||
|
||||
ColorBufferToRDRAM::ColorBufferToRDRAM()
|
||||
: m_pCurFrameBuffer(nullptr)
|
||||
, m_frameCount(-1)
|
||||
, m_startAddress(-1)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -84,46 +82,48 @@ bool ColorBufferToRDRAM::_prepareCopy(u32& _startAddress)
|
|||
readBuffer = m_pCurFrameBuffer->m_FBO;
|
||||
}
|
||||
|
||||
u32 x0 = 0;
|
||||
u32 width;
|
||||
if (config.frameBufferEmulation.nativeResFactor == 0 && m_pCurFrameBuffer->m_scale != 1.0f) {
|
||||
const u32 screenWidth = wnd.getWidth();
|
||||
width = screenWidth;
|
||||
if (wnd.isAdjustScreen()) {
|
||||
width = static_cast<u32>(screenWidth*wnd.getAdjustScale());
|
||||
x0 = (screenWidth - width) / 2;
|
||||
if (!m_pCurFrameBuffer->isAuxiliary()) {
|
||||
u32 x0 = 0;
|
||||
u32 width;
|
||||
if (config.frameBufferEmulation.nativeResFactor == 0 && m_pCurFrameBuffer->m_scale != 1.0f) {
|
||||
const u32 screenWidth = wnd.getWidth();
|
||||
width = screenWidth;
|
||||
if (wnd.isAdjustScreen()) {
|
||||
width = static_cast<u32>(screenWidth*wnd.getAdjustScale());
|
||||
x0 = (screenWidth - width) / 2;
|
||||
}
|
||||
} else {
|
||||
width = m_pCurFrameBuffer->m_pTexture->width;
|
||||
}
|
||||
u32 height = (u32)(bufferHeight * m_pCurFrameBuffer->m_scale);
|
||||
|
||||
CachedTexture * pInputTexture = m_pCurFrameBuffer->m_pTexture;
|
||||
GraphicsDrawer::BlitOrCopyRectParams blitParams;
|
||||
blitParams.srcX0 = x0;
|
||||
blitParams.srcY0 = 0;
|
||||
blitParams.srcX1 = x0 + width;
|
||||
blitParams.srcY1 = height;
|
||||
blitParams.srcWidth = pInputTexture->width;
|
||||
blitParams.srcHeight = pInputTexture->height;
|
||||
blitParams.dstX0 = 0;
|
||||
blitParams.dstY0 = 0;
|
||||
blitParams.dstX1 = m_pCurFrameBuffer->m_width;
|
||||
blitParams.dstY1 = bufferHeight;
|
||||
blitParams.dstWidth = colorBufferTexture->width;
|
||||
blitParams.dstHeight = colorBufferTexture->height;
|
||||
blitParams.filter = m_pCurFrameBuffer->m_scale == 1.0f ? textureParameters::FILTER_NEAREST : textureParameters::FILTER_LINEAR;
|
||||
blitParams.tex[0] = pInputTexture;
|
||||
blitParams.combiner = CombinerInfo::get().getTexrectDownscaleCopyProgram();
|
||||
blitParams.readBuffer = readBuffer;
|
||||
blitParams.drawBuffer = pBuffer->getColorFbFbo();
|
||||
blitParams.mask = blitMask::COLOR_BUFFER;
|
||||
wnd.getDrawer().blitOrCopyTexturedRect(blitParams);
|
||||
|
||||
gfxContext.bindFramebuffer(bufferTarget::READ_FRAMEBUFFER, pBuffer->getColorFbFbo());
|
||||
} else {
|
||||
width = m_pCurFrameBuffer->m_pTexture->width;
|
||||
gfxContext.bindFramebuffer(bufferTarget::READ_FRAMEBUFFER, readBuffer);
|
||||
}
|
||||
u32 height = (u32)(bufferHeight * m_pCurFrameBuffer->m_scale);
|
||||
|
||||
CachedTexture * pInputTexture = m_pCurFrameBuffer->m_pTexture;
|
||||
GraphicsDrawer::BlitOrCopyRectParams blitParams;
|
||||
blitParams.srcX0 = x0;
|
||||
blitParams.srcY0 = 0;
|
||||
blitParams.srcX1 = x0 + width;
|
||||
blitParams.srcY1 = height;
|
||||
blitParams.srcWidth = pInputTexture->width;
|
||||
blitParams.srcHeight = pInputTexture->height;
|
||||
blitParams.dstX0 = 0;
|
||||
blitParams.dstY0 = 0;
|
||||
blitParams.dstX1 = m_pCurFrameBuffer->m_width;
|
||||
blitParams.dstY1 = bufferHeight;
|
||||
blitParams.dstWidth = colorBufferTexture->width;
|
||||
blitParams.dstHeight = colorBufferTexture->height;
|
||||
blitParams.filter = m_pCurFrameBuffer->m_scale == 1.0f ? textureParameters::FILTER_NEAREST : textureParameters::FILTER_LINEAR;
|
||||
blitParams.tex[0] = pInputTexture;
|
||||
blitParams.combiner = CombinerInfo::get().getTexrectDownscaleCopyProgram();
|
||||
blitParams.readBuffer = readBuffer;
|
||||
blitParams.drawBuffer = pBuffer->getColorFbFbo();
|
||||
blitParams.mask = blitMask::COLOR_BUFFER;
|
||||
wnd.getDrawer().blitOrCopyTexturedRect(blitParams);
|
||||
|
||||
gfxContext.bindFramebuffer(bufferTarget::READ_FRAMEBUFFER, pBuffer->getColorFbFbo());
|
||||
|
||||
m_frameCount = curFrame;
|
||||
m_startAddress = _startAddress;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -46,8 +46,6 @@ private:
|
|||
static u32 _RGBAtoRGBA32(u32 _c, u32 x, u32 y);
|
||||
|
||||
FrameBuffer * m_pCurFrameBuffer;
|
||||
u32 m_frameCount;
|
||||
u32 m_startAddress;
|
||||
|
||||
static u32 m_blueNoiseIdx;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue
Block a user