- Once again, tell the 3D renderer which framebuffers need to be flushed per frame so that we can avoid flushing unneeded framebuffers. This fixes a performance regression with many 3D games. (Regression from r5383.)
This commit is contained in:
rogerman 2016-07-01 20:19:13 +00:00
parent e6dac5ec96
commit 9683b7e070
2 changed files with 10 additions and 2 deletions

View File

@ -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 // 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 // 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. // 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->RenderFinish();
CurrentRenderer->SetRenderNeedsFinish(false); CurrentRenderer->SetRenderNeedsFinish(false);
this->_event->DidRender3DEnd(); this->_event->DidRender3DEnd();

View File

@ -2260,9 +2260,13 @@ void gfx3d_VBlankEndSignal(bool skipFrame)
if (CurrentRenderer->GetRenderNeedsFinish()) if (CurrentRenderer->GetRenderNeedsFinish())
{ {
bool need3DDisplayFramebuffer;
bool need3DCaptureFramebuffer;
CurrentRenderer->GetFramebufferFlushStates(need3DDisplayFramebuffer, need3DCaptureFramebuffer);
CurrentRenderer->SetFramebufferFlushStates(false, false); CurrentRenderer->SetFramebufferFlushStates(false, false);
CurrentRenderer->RenderFinish(); CurrentRenderer->RenderFinish();
CurrentRenderer->SetFramebufferFlushStates(true, true); CurrentRenderer->SetFramebufferFlushStates(need3DDisplayFramebuffer, need3DCaptureFramebuffer);
CurrentRenderer->SetRenderNeedsFinish(false); CurrentRenderer->SetRenderNeedsFinish(false);
GPU->GetEventHandler()->DidRender3DEnd(); GPU->GetEventHandler()->DidRender3DEnd();
} }