From cab34080494d34cf792b1e5012ba30e8c7d37d35 Mon Sep 17 00:00:00 2001 From: rogerman Date: Sun, 3 Jul 2016 07:56:59 +0000 Subject: [PATCH] OpenGL Renderer: - Fix a bug where if both flipping and colorspace conversion occur on the CPU, then the 3D framebuffer would flush incorrectly. (Regression from r5455.) --- desmume/src/OGLRender.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/desmume/src/OGLRender.cpp b/desmume/src/OGLRender.cpp index a04aed888..ba81e9290 100644 --- a/desmume/src/OGLRender.cpp +++ b/desmume/src/OGLRender.cpp @@ -1058,7 +1058,7 @@ Render3DError OpenGLRenderer::_FlushFramebufferConvertOnCPU(const FragmentColor { if ( (dstFramebuffer != NULL) && (dstRGBA5551 != NULL) ) { - for (size_t y = 0, ir = 0, iw = ((this->_framebufferHeight - 1) * this->_framebufferWidth); y < this->_framebufferHeight; y++, iw -= (this->_framebufferWidth * 2)) + for (size_t y = 0, ir = 0, iw = ((this->_framebufferHeight - 1) * this->_framebufferWidth); y < this->_framebufferHeight; y++, ir += this->_framebufferWidth, iw -= this->_framebufferWidth) { size_t x = 0; #ifdef ENABLE_SSE2 @@ -1086,14 +1086,14 @@ Render3DError OpenGLRenderer::_FlushFramebufferConvertOnCPU(const FragmentColor } else if (dstFramebuffer != NULL) { - for (size_t y = 0, ir = 0, iw = ((this->_framebufferHeight - 1) * this->_framebufferWidth); y < this->_framebufferHeight; y++, iw -= (this->_framebufferWidth * 2)) + for (size_t y = 0, ir = 0, iw = ((this->_framebufferHeight - 1) * this->_framebufferWidth); y < this->_framebufferHeight; y++, ir += this->_framebufferWidth, iw -= this->_framebufferWidth) { ConvertColorBuffer8888To6665((u32 *)srcFramebuffer + ir, (u32 *)dstFramebuffer + iw, pixCount); } } else { - for (size_t y = 0, ir = 0, iw = ((this->_framebufferHeight - 1) * this->_framebufferWidth); y < this->_framebufferHeight; y++, iw -= (this->_framebufferWidth * 2)) + for (size_t y = 0, ir = 0, iw = ((this->_framebufferHeight - 1) * this->_framebufferWidth); y < this->_framebufferHeight; y++, ir += this->_framebufferWidth, iw -= this->_framebufferWidth) { ConvertColorBuffer8888To5551((u32 *)srcFramebuffer + ir, dstRGBA5551 + iw, pixCount); } @@ -1103,7 +1103,7 @@ Render3DError OpenGLRenderer::_FlushFramebufferConvertOnCPU(const FragmentColor { if ( (dstFramebuffer != NULL) && (dstRGBA5551 != NULL) ) { - for (size_t y = 0, ir = 0, iw = ((this->_framebufferHeight - 1) * this->_framebufferWidth); y < this->_framebufferHeight; y++, iw -= (this->_framebufferWidth * 2)) + for (size_t y = 0, ir = 0, iw = ((this->_framebufferHeight - 1) * this->_framebufferWidth); y < this->_framebufferHeight; y++, ir += this->_framebufferWidth, iw -= this->_framebufferWidth) { size_t x = 0; #ifdef ENABLE_SSE2 @@ -1144,7 +1144,7 @@ Render3DError OpenGLRenderer::_FlushFramebufferConvertOnCPU(const FragmentColor } else { - for (size_t y = 0, ir = 0, iw = ((this->_framebufferHeight - 1) * this->_framebufferWidth); y < this->_framebufferHeight; y++, iw -= (this->_framebufferWidth * 2)) + for (size_t y = 0, ir = 0, iw = ((this->_framebufferHeight - 1) * this->_framebufferWidth); y < this->_framebufferHeight; y++, ir += this->_framebufferWidth, iw -= this->_framebufferWidth) { ConvertColorBuffer8888To5551((u32 *)srcFramebuffer + ir, dstRGBA5551 + iw, pixCount); }