From dc4de340b36a4250020834880609fa9642044110 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Fri, 11 Aug 2023 15:51:54 +0200 Subject: [PATCH] Some debug overlays don't make sense when not in-game, disable them. Minor feedback fixes. --- Common/GPU/Vulkan/thin3d_vulkan.cpp | 1 - Core/Core.cpp | 8 ++++++-- UI/DebugOverlay.cpp | 9 +++++++-- UI/EmuScreen.cpp | 2 +- libretro/LibretroGraphicsContext.h | 2 +- 5 files changed, 15 insertions(+), 7 deletions(-) diff --git a/Common/GPU/Vulkan/thin3d_vulkan.cpp b/Common/GPU/Vulkan/thin3d_vulkan.cpp index ad3a74880dc4..0af1e27a38f2 100644 --- a/Common/GPU/Vulkan/thin3d_vulkan.cpp +++ b/Common/GPU/Vulkan/thin3d_vulkan.cpp @@ -1104,7 +1104,6 @@ VKContext::~VKContext() { } void VKContext::BeginFrame(DebugFlags debugFlags) { - // TODO: Bad dependency on g_Config here! renderManager_.BeginFrame(debugFlags & DebugFlags::PROFILE_TIMESTAMPS, debugFlags & DebugFlags::PROFILE_SCOPES); FrameData &frame = frame_[vulkan_->GetCurFrame()]; diff --git a/Core/Core.cpp b/Core/Core.cpp index 4abed1a00429..6dc3fd759afc 100644 --- a/Core/Core.cpp +++ b/Core/Core.cpp @@ -216,12 +216,16 @@ void Core_RunLoop(GraphicsContext *ctx) { bool menuThrottle = (GetUIState() != UISTATE_INGAME || !PSP_IsInited()) && GetUIState() != UISTATE_EXIT; - // In case it was pending, we're not in game anymore. - double startTime = time_now_d(); + double startTime; + if (menuThrottle) { + startTime = time_now_d(); + } + NativeFrame(ctx); if (menuThrottle) { // Simple throttling to not burn the GPU in the menu. + // TODO: This should move into NativeFrame. Also, it's only necessary in MAILBOX or IMMEDIATE presentation modes. double diffTime = time_now_d() - startTime; int sleepTime = (int)(1000.0 / refreshRate) - (int)(diffTime * 1000.0); if (sleepTime > 0) diff --git a/UI/DebugOverlay.cpp b/UI/DebugOverlay.cpp index 3f8c781137ff..4ccdb8999850 100644 --- a/UI/DebugOverlay.cpp +++ b/UI/DebugOverlay.cpp @@ -6,6 +6,7 @@ #include "Core/HLE/sceSas.h" #include "Core/ControlMapper.h" #include "Core/Config.h" +#include "Core/System.h" #include "GPU/GPU.h" // TODO: This should be moved here or to Common, doesn't belong in /GPU #include "GPU/Vulkan/DebugVisVulkan.h" @@ -164,12 +165,16 @@ void DrawControlMapperOverlay(UIContext *ctx, const Bounds &bounds, const Contro } void DrawDebugOverlay(UIContext *ctx, const Bounds &bounds, DebugOverlay overlay) { + bool inGame = GetUIState() == UISTATE_INGAME; + switch (overlay) { case DebugOverlay::DEBUG_STATS: - DrawDebugStats(ctx, ctx->GetLayoutBounds()); + if (!inGame) + DrawDebugStats(ctx, ctx->GetLayoutBounds()); break; case DebugOverlay::FRAME_GRAPH: - DrawFrameTimes(ctx, ctx->GetLayoutBounds()); + if (!inGame) + DrawFrameTimes(ctx, ctx->GetLayoutBounds()); break; case DebugOverlay::FRAME_TIMING: DrawFrameTiming(ctx, ctx->GetLayoutBounds()); diff --git a/UI/EmuScreen.cpp b/UI/EmuScreen.cpp index 536058458931..156ba9447866 100644 --- a/UI/EmuScreen.cpp +++ b/UI/EmuScreen.cpp @@ -1504,7 +1504,7 @@ bool EmuScreen::hasVisibleUI() { if (g_Config.bEnableCardboardVR || g_Config.bEnableNetworkChat) return true; // Debug UI. - if ((DebugOverlay)g_Config.iDebugOverlay != DebugOverlay::OFF) + if ((DebugOverlay)g_Config.iDebugOverlay != DebugOverlay::OFF || g_Config.bShowDeveloperMenu) return true; // Exception information. diff --git a/libretro/LibretroGraphicsContext.h b/libretro/LibretroGraphicsContext.h index dbb4f3b051c7..ca267afdf8d6 100644 --- a/libretro/LibretroGraphicsContext.h +++ b/libretro/LibretroGraphicsContext.h @@ -22,7 +22,7 @@ class LibretroGraphicsContext : public GraphicsContext { DestroyDrawContext(); } void SwapInterval(int interval) override {} - virtual void SwapBuffers() = 0; + virtual void SwapBuffers() = 0; void Resize() override {} virtual void GotBackbuffer();