From b205529aecdf6f3496ced59697571cd8842b35c6 Mon Sep 17 00:00:00 2001 From: Sergey Lipskiy Date: Wed, 29 Apr 2015 19:31:04 +0600 Subject: [PATCH] Revert "Don't copy depth buffer to RDRAM if it was not cleared completly." This commit causes 2 regressions: #436, #437 Better solution needed. This reverts commit 8b551549e0ca5ece29c5322cb062e8a9bc11e48e. --- src/DepthBuffer.cpp | 6 +++--- src/DepthBuffer.h | 2 +- src/OpenGL.cpp | 4 ++-- src/OpenGL.h | 2 +- src/gDP.cpp | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/DepthBuffer.cpp b/src/DepthBuffer.cpp index 583d5dbb..593557d5 100644 --- a/src/DepthBuffer.cpp +++ b/src/DepthBuffer.cpp @@ -84,7 +84,7 @@ void DepthBuffer::initDepthImageTexture(FrameBuffer * _pBuffer) glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); glBindFramebuffer(GL_DRAW_FRAMEBUFFER, _pBuffer->m_FBO); - depthBufferList().clearBuffer(true); + depthBufferList().clearBuffer(); #endif // GL_IMAGE_TEXTURES_SUPPORT } @@ -306,11 +306,11 @@ void DepthBufferList::saveBuffer(u32 _address) } -void DepthBufferList::clearBuffer(bool _fullsize) +void DepthBufferList::clearBuffer() { if (m_pCurrent == NULL) return; - m_pCurrent->m_cleared = _fullsize; + m_pCurrent->m_cleared = true; #ifdef GL_IMAGE_TEXTURES_SUPPORT if (m_pCurrent->m_FBO == 0 || !video().getRender().isImageTexturesSupported() || config.frameBufferEmulation.N64DepthCompare == 0) return; diff --git a/src/DepthBuffer.h b/src/DepthBuffer.h index e5eccbe0..a7993ae6 100644 --- a/src/DepthBuffer.h +++ b/src/DepthBuffer.h @@ -38,7 +38,7 @@ public: void destroy(); void saveBuffer(u32 _address); void removeBuffer(u32 _address); - void clearBuffer(bool _fullsize); + void clearBuffer(); void setNotCleared(); DepthBuffer *findBuffer(u32 _address); DepthBuffer * getCurrent() const {return m_pCurrent;} diff --git a/src/OpenGL.cpp b/src/OpenGL.cpp index c5bb3405..ffcedeaf 100644 --- a/src/OpenGL.cpp +++ b/src/OpenGL.cpp @@ -1144,12 +1144,12 @@ void OGLRender::drawText(const char *_pText, float x, float y) TextDrawer::get().renderText(_pText, x, y); } -void OGLRender::clearDepthBuffer(bool _fullsize) +void OGLRender::clearDepthBuffer() { if (config.frameBufferEmulation.enable && frameBufferList().getCurrent() == NULL) return; - depthBufferList().clearBuffer(_fullsize); + depthBufferList().clearBuffer(); glDisable( GL_SCISSOR_TEST ); glDepthMask( TRUE ); diff --git a/src/OpenGL.h b/src/OpenGL.h index cb6d8248..cbf1c2d6 100644 --- a/src/OpenGL.h +++ b/src/OpenGL.h @@ -59,7 +59,7 @@ public: }; void drawTexturedRect(const TexturedRectParams & _params); void drawText(const char *_pText, float x, float y); - void clearDepthBuffer(bool _fullsize); + void clearDepthBuffer(); void clearColorBuffer( float * _pColor ); int getTrianglesCount() const {return triangles.num;} diff --git a/src/gDP.cpp b/src/gDP.cpp index 9ffddd38..f2cb7b72 100644 --- a/src/gDP.cpp +++ b/src/gDP.cpp @@ -757,13 +757,13 @@ void gDPFillRectangle( s32 ulx, s32 uly, s32 lrx, s32 lry ) // If color is not depth clear color, that is most likely the case if (gDP.fillColor.color == DepthClearColor) { gDPFillRDRAM(gDP.colorImage.address, ulx, uly, lrx, lry, gDP.colorImage.width, gDP.colorImage.size, gDP.fillColor.color); - render.clearDepthBuffer(lrx - ulx >= gDP.scissor.lrx - gDP.scissor.ulx && lry - uly >= gDP.scissor.lry - gDP.scissor.uly); + render.clearDepthBuffer(); return; } } else if (gDP.fillColor.color == DepthClearColor && gDP.otherMode.cycleType == G_CYC_FILL) { depthBufferList().saveBuffer(gDP.colorImage.address); gDPFillRDRAM(gDP.colorImage.address, ulx, uly, lrx, lry, gDP.colorImage.width, gDP.colorImage.size, gDP.fillColor.color); - render.clearDepthBuffer(lrx - ulx == gDP.scissor.lrx - gDP.scissor.ulx && lry - uly == gDP.scissor.lry - gDP.scissor.uly); + render.clearDepthBuffer(); return; }