From e9c7eaf427935e15296ce2a30cc2d800bb978214 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Mon, 14 Oct 2024 11:04:21 +0200 Subject: [PATCH] Be more consistent with NotifyPresent .. --- GPU/Common/FramebufferManagerCommon.cpp | 10 +++++++--- UI/EmuScreen.cpp | 3 +-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/GPU/Common/FramebufferManagerCommon.cpp b/GPU/Common/FramebufferManagerCommon.cpp index 12c2a70cd2..6b6de5288f 100644 --- a/GPU/Common/FramebufferManagerCommon.cpp +++ b/GPU/Common/FramebufferManagerCommon.cpp @@ -1567,9 +1567,9 @@ void FramebufferManagerCommon::CopyDisplayToOutput(bool reallyDirty) { // No framebuffer to display! Clear to black. if (useBufferedRendering_) { draw_->BindFramebufferAsRenderTarget(nullptr, { Draw::RPAction::CLEAR, Draw::RPAction::CLEAR, Draw::RPAction::CLEAR }, "CopyDisplayToOutput"); - presentation_->NotifyPresent(); } gstate_c.Dirty(DIRTY_VIEWPORTSCISSOR_STATE); + presentation_->NotifyPresent(); return; } @@ -1628,6 +1628,7 @@ void FramebufferManagerCommon::CopyDisplayToOutput(bool reallyDirty) { if (Memory::IsValidAddress(fbaddr)) { // The game is displaying something directly from RAM. In GTA, it's decoded video. DrawFramebufferToOutput(Memory::GetPointerUnchecked(fbaddr), displayStride_, displayFormat_); + // This effectively calls presentation_->NotifyPresent(); return; } else { DEBUG_LOG(Log::FrameBuf, "Found no FBO to display! displayFBPtr = %08x", fbaddr); @@ -1635,8 +1636,9 @@ void FramebufferManagerCommon::CopyDisplayToOutput(bool reallyDirty) { if (useBufferedRendering_) { // Bind and clear the backbuffer. This should be the first time during the frame that it's bound. draw_->BindFramebufferAsRenderTarget(nullptr, { Draw::RPAction::CLEAR, Draw::RPAction::CLEAR, Draw::RPAction::CLEAR }, "CopyDisplayToOutput_NoFBO"); - } + } // For non-buffered rendering, every frame is cleared anyway. gstate_c.Dirty(DIRTY_VIEWPORTSCISSOR_STATE); + presentation_->NotifyPresent(); return; } } @@ -1700,7 +1702,9 @@ void FramebufferManagerCommon::CopyDisplayToOutput(bool reallyDirty) { presentation_->SourceFramebuffer(vfb->fbo, actualWidth, actualHeight); presentation_->CopyToOutput(flags, uvRotation, u0, v0, u1, v1); } else if (useBufferedRendering_) { - WARN_LOG(Log::FrameBuf, "Current VFB lacks an FBO: %08x", vfb->fb_address); + WARN_LOG(Log::FrameBuf, "Using buffered rendering, and current VFB lacks an FBO: %08x", vfb->fb_address); + } else { + presentation_->NotifyPresent(); } // This may get called mid-draw if the game uses an immediate flip. diff --git a/UI/EmuScreen.cpp b/UI/EmuScreen.cpp index ec6b47b6e0..ef5410428f 100644 --- a/UI/EmuScreen.cpp +++ b/UI/EmuScreen.cpp @@ -1366,7 +1366,6 @@ ScreenRenderFlags EmuScreen::render(ScreenRenderMode mode) { draw->SetViewport(viewport); draw->SetScissorRect(0, 0, g_display.pixel_xres, g_display.pixel_yres); - skipBufferEffects = true; framebufferBound = true; } draw->SetTargetSize(g_display.pixel_xres, g_display.pixel_yres); @@ -1510,7 +1509,7 @@ ScreenRenderFlags EmuScreen::render(ScreenRenderMode mode) { Draw::BackendState state = draw->GetCurrentBackendState(); // We allow if !state.valid, that means it's not the Vulkan backend. - _assert_msg_(!state.valid || state.passes >= 1, "skipB: %d sw: %d", (int)skipBufferEffects, (int)g_Config.bSoftwareRendering); + _assert_msg_(!state.valid || state.passes >= 1, "skipB: %d sw: %d screenmode: %d", (int)skipBufferEffects, (int)g_Config.bSoftwareRendering, mode); screenManager()->getUIContext()->BeginFrame();