Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some debug overlays don't make sense when not in-game, disable them #17902

Merged
merged 1 commit into from
Aug 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Common/GPU/Vulkan/thin3d_vulkan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()];
Expand Down
8 changes: 6 additions & 2 deletions Core/Core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
9 changes: 7 additions & 2 deletions UI/DebugOverlay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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());
Expand Down
2 changes: 1 addition & 1 deletion UI/EmuScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion libretro/LibretroGraphicsContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down