diff --git a/desmume/src/GPU.cpp b/desmume/src/GPU.cpp index 6614e1aee..17b3814e7 100644 --- a/desmume/src/GPU.cpp +++ b/desmume/src/GPU.cpp @@ -7378,8 +7378,12 @@ void GPUSubsystem::RenderLine(const u16 l, bool isFrameSkipRequested) // originates from the top of the screen, the BG0 layer will only be enabled at line 46. This // means that we need to check the states at that particular time to ensure that the 3D renderer // finishes before we read the 3D framebuffer. Otherwise, the map will render incorrectly. - if ( CurrentRenderer->GetRenderNeedsFinish() && (this->_engineMain->WillRender3DLayer() || this->_engineMain->WillCapture3DLayerDirect()) ) + const bool need3DDisplayFramebuffer = this->_engineMain->WillRender3DLayer(); + const bool need3DCaptureFramebuffer = this->_engineMain->WillCapture3DLayerDirect(); + + if ( CurrentRenderer->GetRenderNeedsFinish() && (need3DDisplayFramebuffer || need3DCaptureFramebuffer) ) { + CurrentRenderer->SetFramebufferFlushStates(need3DDisplayFramebuffer, need3DCaptureFramebuffer); CurrentRenderer->RenderFinish(); CurrentRenderer->SetRenderNeedsFinish(false); this->_event->DidRender3DEnd(); diff --git a/desmume/src/gfx3d.cpp b/desmume/src/gfx3d.cpp index 4da1e2666..d948179f9 100644 --- a/desmume/src/gfx3d.cpp +++ b/desmume/src/gfx3d.cpp @@ -2260,9 +2260,13 @@ void gfx3d_VBlankEndSignal(bool skipFrame) if (CurrentRenderer->GetRenderNeedsFinish()) { + bool need3DDisplayFramebuffer; + bool need3DCaptureFramebuffer; + CurrentRenderer->GetFramebufferFlushStates(need3DDisplayFramebuffer, need3DCaptureFramebuffer); + CurrentRenderer->SetFramebufferFlushStates(false, false); CurrentRenderer->RenderFinish(); - CurrentRenderer->SetFramebufferFlushStates(true, true); + CurrentRenderer->SetFramebufferFlushStates(need3DDisplayFramebuffer, need3DCaptureFramebuffer); CurrentRenderer->SetRenderNeedsFinish(false); GPU->GetEventHandler()->DidRender3DEnd(); }