diff --git a/src/gDP.cpp b/src/gDP.cpp index 9d7814c4..f5f5c25f 100644 --- a/src/gDP.cpp +++ b/src/gDP.cpp @@ -758,18 +758,23 @@ void gDPFillRectangle( s32 ulx, s32 uly, s32 lrx, s32 lry ) } else if (lry == uly) ++lry; + bool bClearBuffer = false; if (gDP.depthImageAddress == gDP.colorImage.address) { // Game may use depth texture as auxilary color texture. Example: Mario Tennis // 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(uly, lry); + bClearBuffer = true; } } 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(uly, lry); - } else { + bClearBuffer = true; + } + + if (!bClearBuffer) { frameBufferList().setBufferChanged(); f32 fillColor[4]; gDPGetFillColor(fillColor);