diff --git a/src/BufferCopy/ColorBufferToRDRAM.cpp b/src/BufferCopy/ColorBufferToRDRAM.cpp index fa223620..67a9f288 100644 --- a/src/BufferCopy/ColorBufferToRDRAM.cpp +++ b/src/BufferCopy/ColorBufferToRDRAM.cpp @@ -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(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(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; } diff --git a/src/BufferCopy/ColorBufferToRDRAM.h b/src/BufferCopy/ColorBufferToRDRAM.h index 7248c6a1..dd48096f 100644 --- a/src/BufferCopy/ColorBufferToRDRAM.h +++ b/src/BufferCopy/ColorBufferToRDRAM.h @@ -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; };