mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 05:19:56 +00:00
Move DebugOverlay rendering to the overlay screen, allowing drawing it on top of the menu
This commit is contained in:
parent
8ef781faff
commit
a32249a3cf
@ -179,6 +179,7 @@ static const ConfigSetting generalSettings[] = {
|
||||
ConfigSetting("CwCheatRefreshRate", &g_Config.iCwCheatRefreshRate, 77, CfgFlag::PER_GAME),
|
||||
ConfigSetting("CwCheatScrollPosition", &g_Config.fCwCheatScrollPosition, 0.0f, CfgFlag::PER_GAME),
|
||||
ConfigSetting("GameListScrollPosition", &g_Config.fGameListScrollPosition, 0.0f, CfgFlag::DEFAULT),
|
||||
ConfigSetting("DebugOverlay", &g_Config.iDebugOverlay, 0, CfgFlag::DONT_SAVE),
|
||||
|
||||
ConfigSetting("ScreenshotsAsPNG", &g_Config.bScreenshotsAsPNG, false, CfgFlag::PER_GAME),
|
||||
ConfigSetting("UseFFV1", &g_Config.bUseFFV1, false, CfgFlag::DEFAULT),
|
||||
|
@ -471,7 +471,7 @@ public:
|
||||
|
||||
// Volatile development settings
|
||||
// Overlays
|
||||
DebugOverlay iDebugOverlay;
|
||||
int iDebugOverlay;
|
||||
|
||||
bool bGpuLogProfiler; // Controls the Vulkan logging profiler (profiles textures uploads etc).
|
||||
|
||||
|
@ -496,7 +496,7 @@ static void DoFrameIdleTiming() {
|
||||
#endif
|
||||
}
|
||||
|
||||
if (g_Config.iDebugOverlay == DebugOverlay::FRAME_GRAPH || coreCollectDebugStats) {
|
||||
if ((DebugOverlay)g_Config.iDebugOverlay == DebugOverlay::FRAME_GRAPH || coreCollectDebugStats) {
|
||||
DisplayNotifySleep(time_now_d() - before);
|
||||
}
|
||||
}
|
||||
@ -662,7 +662,7 @@ void __DisplayFlip(int cyclesLate) {
|
||||
CoreTiming::ScheduleEvent(0 - cyclesLate, afterFlipEvent, 0);
|
||||
numVBlanksSinceFlip = 0;
|
||||
|
||||
if (g_Config.iDebugOverlay == DebugOverlay::FRAME_GRAPH || coreCollectDebugStats) {
|
||||
if ((DebugOverlay)g_Config.iDebugOverlay == DebugOverlay::FRAME_GRAPH || coreCollectDebugStats) {
|
||||
// Track how long we sleep (whether vsync or sleep_ms.)
|
||||
DisplayNotifySleep(time_now_d() - frameSleepStart, frameSleepPos);
|
||||
}
|
||||
@ -726,7 +726,7 @@ void hleLagSync(u64 userdata, int cyclesLate) {
|
||||
const int over = (int)((now - goal) * 1000000);
|
||||
ScheduleLagSync(over - emuOver);
|
||||
|
||||
if (g_Config.iDebugOverlay == DebugOverlay::FRAME_GRAPH || coreCollectDebugStats) {
|
||||
if ((DebugOverlay)g_Config.iDebugOverlay == DebugOverlay::FRAME_GRAPH || coreCollectDebugStats) {
|
||||
DisplayNotifySleep(now - before);
|
||||
}
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ static void CalculateFPS() {
|
||||
}
|
||||
}
|
||||
|
||||
if (g_Config.iDebugOverlay == DebugOverlay::FRAME_GRAPH || coreCollectDebugStats) {
|
||||
if ((DebugOverlay)g_Config.iDebugOverlay == DebugOverlay::FRAME_GRAPH || coreCollectDebugStats) {
|
||||
frameTimeHistory[frameTimeHistoryPos++] = now - lastFrameTimeHistory;
|
||||
lastFrameTimeHistory = now;
|
||||
frameTimeHistoryPos = frameTimeHistoryPos % frameTimeHistorySize;
|
||||
@ -182,6 +182,10 @@ void DisplayNotifySleep(double t, int pos) {
|
||||
|
||||
void __DisplayGetDebugStats(char *stats, size_t bufsize) {
|
||||
char statbuf[4096];
|
||||
if (!gpu) {
|
||||
snprintf(stats, bufsize, "N/A");
|
||||
return;
|
||||
}
|
||||
gpu->GetStats(statbuf, sizeof(statbuf));
|
||||
|
||||
snprintf(stats, bufsize,
|
||||
|
@ -142,7 +142,7 @@ void TextureCacheCommon::StartFrame() {
|
||||
timesInvalidatedAllThisFrame_ = 0;
|
||||
replacementTimeThisFrame_ = 0.0;
|
||||
|
||||
if (g_Config.iDebugOverlay == DebugOverlay::DEBUG_STATS) {
|
||||
if ((DebugOverlay)g_Config.iDebugOverlay == DebugOverlay::DEBUG_STATS) {
|
||||
gpuStats.numReplacerTrackedTex = replacer_.GetNumTrackedTextures();
|
||||
gpuStats.numCachedReplacedTextures = replacer_.GetNumCachedReplacedTextures();
|
||||
}
|
||||
|
@ -217,7 +217,7 @@ void OSXOpenURL(const char *url) {
|
||||
item.state = [self controlStateForBool:g_Config.bIgnoreBadMemAccess];
|
||||
break;
|
||||
case 12:
|
||||
item.state = [self controlStateForBool:g_Config.iDebugOverlay == DebugOverlay::DEBUG_STATS];
|
||||
item.state = [self controlStateForBool:(DebugOverlay)g_Config.iDebugOverlay == DebugOverlay::DEBUG_STATS];
|
||||
break;
|
||||
default:
|
||||
item.enabled = state == UISTATE_INGAME ? YES : NO;
|
||||
@ -405,7 +405,7 @@ void OSXOpenURL(const char *url) {
|
||||
copyBaseAddr.target = self;
|
||||
copyBaseAddr.tag = 11;
|
||||
|
||||
MENU_ITEM(showDebugStatsAction, DESKTOPUI_LOCALIZED("Show Debug Statistics"), @selector(toggleShowDebugStats:), (g_Config.iDebugOverlay == DebugOverlay::DEBUG_STATS), 12)
|
||||
MENU_ITEM(showDebugStatsAction, DESKTOPUI_LOCALIZED("Show Debug Statistics"), @selector(toggleShowDebugStats:), ((DebugOverlay)g_Config.iDebugOverlay == DebugOverlay::DEBUG_STATS), 12)
|
||||
|
||||
[parent addItem:loadSymbolMapAction];
|
||||
[parent addItem:saveMapFileAction];
|
||||
@ -544,13 +544,13 @@ TOGGLE_METHOD(FullScreen, g_Config.bFullScreen, System_MakeRequest(SystemRequest
|
||||
#undef TOGGLE_METHOD
|
||||
|
||||
-(void)toggleShowDebugStats: (NSMenuItem *)item { \
|
||||
if (g_Config.iDebugOverlay == DebugOverlay::DEBUG_STATS) {
|
||||
if ((DebugOverlay)g_Config.iDebugOverlay == DebugOverlay::DEBUG_STATS) {
|
||||
g_Config.iDebugOverlay = DebugOverlay::OFF;
|
||||
} else {
|
||||
g_Config.iDebugOverlay = DebugOverlay::DEBUG_STATS;
|
||||
}
|
||||
System_PostUIMessage("clear jit", "");
|
||||
item.state = [self controlStateForBool: g_Config.iDebugOverlay == DebugOverlay::DEBUG_STATS]; \
|
||||
item.state = [self controlStateForBool: (DebugOverlay)g_Config.iDebugOverlay == DebugOverlay::DEBUG_STATS]; \
|
||||
}
|
||||
|
||||
-(void)setToggleShowCounterItem: (NSMenuItem *)item {
|
||||
|
@ -150,7 +150,11 @@ static void DrawFrameTiming(UIContext *ctx, const Bounds &bounds) {
|
||||
ctx->RebindTexture();
|
||||
}
|
||||
|
||||
void DrawDebugOverlay(UIContext *ctx, const Bounds &bounds, const ControlMapper &controlMapper, DebugOverlay overlay) {
|
||||
void DrawControlMapperOverlay(UIContext *ctx, const Bounds &bounds, const ControlMapper &controlMapper) {
|
||||
DrawControlDebug(ctx, controlMapper, ctx->GetLayoutBounds());
|
||||
}
|
||||
|
||||
void DrawDebugOverlay(UIContext *ctx, const Bounds &bounds, DebugOverlay overlay) {
|
||||
switch (overlay) {
|
||||
case DebugOverlay::DEBUG_STATS:
|
||||
DrawDebugStats(ctx, ctx->GetLayoutBounds());
|
||||
@ -164,11 +168,7 @@ void DrawDebugOverlay(UIContext *ctx, const Bounds &bounds, const ControlMapper
|
||||
case DebugOverlay::AUDIO:
|
||||
DrawAudioDebugStats(ctx, ctx->GetLayoutBounds());
|
||||
break;
|
||||
case DebugOverlay::CONTROL:
|
||||
DrawControlDebug(ctx, controlMapper, ctx->GetLayoutBounds());
|
||||
break;
|
||||
#if !PPSSPP_PLATFORM(UWP) && !PPSSPP_PLATFORM(SWITCH)
|
||||
|
||||
case DebugOverlay::GPU_PROFILE:
|
||||
if (g_Config.iGPUBackend == (int)GPUBackend::VULKAN || g_Config.iGPUBackend == (int)GPUBackend::OPENGL) {
|
||||
DrawGPUProfilerVis(ctx, gpu);
|
||||
@ -180,5 +180,7 @@ void DrawDebugOverlay(UIContext *ctx, const Bounds &bounds, const ControlMapper
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -4,4 +4,5 @@
|
||||
#include "Core/ConfigValues.h"
|
||||
#include "Core/ControlMapper.h"
|
||||
|
||||
void DrawDebugOverlay(UIContext *ctx, const Bounds &bounds, const ControlMapper &controlMapper, DebugOverlay overlay);
|
||||
void DrawControlMapperOverlay(UIContext *ctx, const Bounds &bounds, const ControlMapper &controlMapper);
|
||||
void DrawDebugOverlay(UIContext *ctx, const Bounds &bounds, DebugOverlay overlay);
|
||||
|
@ -776,7 +776,7 @@ void SystemInfoScreen::CreateTabs() {
|
||||
if (mode == vk->GetPresentMode()) {
|
||||
str += std::string(" (") + di->T("Current") + ")";
|
||||
}
|
||||
presentModes->Add(new TextView(VulkanPresentModeToString(mode), new LayoutParams(FILL_PARENT, WRAP_CONTENT)))->SetFocusable(true);
|
||||
presentModes->Add(new TextView(str, new LayoutParams(FILL_PARENT, WRAP_CONTENT)))->SetFocusable(true);
|
||||
}
|
||||
|
||||
CollapsibleSection *colorFormats = gpuExtensions->Add(new CollapsibleSection(si->T("Display Color Formats")));
|
||||
|
@ -1427,7 +1427,7 @@ void EmuScreen::render() {
|
||||
}
|
||||
}
|
||||
|
||||
Core_UpdateDebugStats(g_Config.iDebugOverlay == DebugOverlay::DEBUG_STATS || g_Config.bLogFrameDrops);
|
||||
Core_UpdateDebugStats((DebugOverlay)g_Config.iDebugOverlay == DebugOverlay::DEBUG_STATS || g_Config.bLogFrameDrops);
|
||||
|
||||
bool blockedExecution = Achievements::IsBlockingExecution();
|
||||
if (!blockedExecution) {
|
||||
@ -1503,7 +1503,7 @@ bool EmuScreen::hasVisibleUI() {
|
||||
if (g_Config.bEnableCardboardVR || g_Config.bEnableNetworkChat)
|
||||
return true;
|
||||
// Debug UI.
|
||||
if (g_Config.iDebugOverlay != DebugOverlay::OFF)
|
||||
if ((DebugOverlay)g_Config.iDebugOverlay != DebugOverlay::OFF)
|
||||
return true;
|
||||
|
||||
// Exception information.
|
||||
@ -1538,8 +1538,9 @@ void EmuScreen::renderUI() {
|
||||
}
|
||||
|
||||
if (!invalid_) {
|
||||
DrawDebugOverlay(ctx, ctx->GetLayoutBounds(), controlMapper_, g_Config.iDebugOverlay);
|
||||
|
||||
if ((DebugOverlay)g_Config.iDebugOverlay == DebugOverlay::CONTROL) {
|
||||
DrawControlMapperOverlay(ctx, ctx->GetLayoutBounds(), controlMapper_);
|
||||
}
|
||||
if (g_Config.iShowStatusFlags) {
|
||||
DrawFPS(ctx, ctx->GetLayoutBounds());
|
||||
}
|
||||
|
@ -1098,7 +1098,7 @@ void NativeRender(GraphicsContext *graphicsContext) {
|
||||
g_screenManager->getUIContext()->SetTintSaturation(g_Config.fUITint, g_Config.fUISaturation);
|
||||
|
||||
Draw::DebugFlags debugFlags = Draw::DebugFlags::NONE;
|
||||
if (g_Config.iDebugOverlay == DebugOverlay::GPU_PROFILE)
|
||||
if ((DebugOverlay)g_Config.iDebugOverlay == DebugOverlay::GPU_PROFILE)
|
||||
debugFlags |= Draw::DebugFlags::PROFILE_TIMESTAMPS;
|
||||
if (g_Config.bGpuLogProfiler)
|
||||
debugFlags |= Draw::DebugFlags::PROFILE_SCOPES;
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "Common/Math/math_util.h"
|
||||
#include "Common/UI/IconCache.h"
|
||||
#include "UI/RetroAchievementScreens.h"
|
||||
#include "UI/DebugOverlay.h"
|
||||
|
||||
#include "Common/UI/Context.h"
|
||||
#include "Common/System/OSD.h"
|
||||
@ -456,6 +457,18 @@ void OSDOverlayScreen::CreateViews() {
|
||||
root_->Add(new OnScreenMessagesView(new UI::AnchorLayoutParams(0.0f, 0.0f, 0.0f, 0.0f)));
|
||||
}
|
||||
|
||||
void OSDOverlayScreen::render() {
|
||||
UIScreen::render();
|
||||
|
||||
DebugOverlay debugOverlay = (DebugOverlay)g_Config.iDebugOverlay;
|
||||
|
||||
// Special case control for now, since it uses the control mapper that's owned by EmuScreen.
|
||||
if (debugOverlay != DebugOverlay::OFF && debugOverlay != DebugOverlay::CONTROL) {
|
||||
UIContext *uiContext = screenManager()->getUIContext();
|
||||
DrawDebugOverlay(uiContext, uiContext->GetLayoutBounds(), debugOverlay);
|
||||
}
|
||||
}
|
||||
|
||||
void NoticeView::GetContentDimensionsBySpec(const UIContext &dc, UI::MeasureSpec horiz, UI::MeasureSpec vert, float &w, float &h) const {
|
||||
Bounds bounds(0, 0, layoutParams_->width, layoutParams_->height);
|
||||
if (bounds.w < 0) {
|
||||
|
@ -28,6 +28,7 @@ class OSDOverlayScreen : public UIScreen {
|
||||
public:
|
||||
const char *tag() const override { return "OSDOverlayScreen"; }
|
||||
void CreateViews() override;
|
||||
void render() override;
|
||||
};
|
||||
|
||||
enum class NoticeLevel {
|
||||
|
@ -711,10 +711,10 @@ namespace MainWindow {
|
||||
case ID_DEBUG_SHOWDEBUGSTATISTICS:
|
||||
// This is still useful as a shortcut to tell users to use.
|
||||
// So let's fake the enum.
|
||||
if (g_Config.iDebugOverlay == DebugOverlay::DEBUG_STATS) {
|
||||
g_Config.iDebugOverlay = DebugOverlay::OFF;
|
||||
if ((DebugOverlay)g_Config.iDebugOverlay == DebugOverlay::DEBUG_STATS) {
|
||||
g_Config.iDebugOverlay = (int)DebugOverlay::OFF;
|
||||
} else {
|
||||
g_Config.iDebugOverlay = DebugOverlay::DEBUG_STATS;
|
||||
g_Config.iDebugOverlay = (int)DebugOverlay::DEBUG_STATS;
|
||||
}
|
||||
System_PostUIMessage("clear jit", "");
|
||||
break;
|
||||
@ -964,7 +964,7 @@ namespace MainWindow {
|
||||
HMENU menu = GetMenu(GetHWND());
|
||||
#define CHECKITEM(item,value) CheckMenuItem(menu,item,MF_BYCOMMAND | ((value) ? MF_CHECKED : MF_UNCHECKED));
|
||||
CHECKITEM(ID_DEBUG_IGNOREILLEGALREADS, g_Config.bIgnoreBadMemAccess);
|
||||
CHECKITEM(ID_DEBUG_SHOWDEBUGSTATISTICS, g_Config.iDebugOverlay == DebugOverlay::DEBUG_STATS);
|
||||
CHECKITEM(ID_DEBUG_SHOWDEBUGSTATISTICS, (DebugOverlay)g_Config.iDebugOverlay == DebugOverlay::DEBUG_STATS);
|
||||
CHECKITEM(ID_OPTIONS_HARDWARETRANSFORM, g_Config.bHardwareTransform);
|
||||
CHECKITEM(ID_DEBUG_BREAKONLOAD, !g_Config.bAutoRun);
|
||||
CHECKITEM(ID_OPTIONS_VERTEXCACHE, g_Config.bVertexCache);
|
||||
|
@ -234,7 +234,7 @@ bool RunAutoTest(HeadlessHost *headlessHost, CoreParameter &coreParameter, const
|
||||
|
||||
System_Notify(SystemNotification::BOOT_DONE);
|
||||
|
||||
Core_UpdateDebugStats(g_Config.iDebugOverlay == DebugOverlay::DEBUG_STATS || g_Config.bLogFrameDrops);
|
||||
Core_UpdateDebugStats((DebugOverlay)g_Config.iDebugOverlay == DebugOverlay::DEBUG_STATS || g_Config.bLogFrameDrops);
|
||||
|
||||
PSP_BeginHostFrame();
|
||||
Draw::DrawContext *draw = coreParameter.graphicsContext ? coreParameter.graphicsContext->GetDrawContext() : nullptr;
|
||||
|
Loading…
Reference in New Issue
Block a user