From 45072fccb2e263757bd68b96686ded96fb50be78 Mon Sep 17 00:00:00 2001 From: Exzap <13877693+Exzap@users.noreply.github.com> Date: Sat, 24 Jun 2023 08:04:40 +0200 Subject: [PATCH] Remove remnants of frame profiler code --- src/Cafe/HW/Latte/Core/LatteOverlay.cpp | 39 ------------------- src/Cafe/HW/Latte/Core/LatteOverlay.h | 1 - .../HW/Latte/Core/LattePerformanceMonitor.cpp | 1 - .../Renderer/OpenGL/OpenGLRendererCore.cpp | 18 ++------- src/Cafe/OS/libs/coreinit/coreinit.cpp | 9 +++-- src/config/ActiveSettings.cpp | 10 ----- src/config/ActiveSettings.h | 5 --- src/gui/MainWindow.cpp | 7 ---- 8 files changed, 9 insertions(+), 81 deletions(-) diff --git a/src/Cafe/HW/Latte/Core/LatteOverlay.cpp b/src/Cafe/HW/Latte/Core/LatteOverlay.cpp index 7cc72fdb..ff5238d5 100644 --- a/src/Cafe/HW/Latte/Core/LatteOverlay.cpp +++ b/src/Cafe/HW/Latte/Core/LatteOverlay.cpp @@ -604,42 +604,3 @@ void LatteOverlay_updateStats(double fps, sint32 drawcalls) // update vram g_renderer->GetVRAMInfo(g_state.vramUsage, g_state.vramTotal); } - -void LatteOverlay_updateStatsPerFrame() -{ - if (!ActiveSettings::FrameProfilerEnabled()) - return; - // update frametime graph - uint32 frameTime_total = (uint32)PPCTimer_tscToMicroseconds(performanceMonitor.gpuTime_frameTime.getPreviousFrameValue()); - uint32 frameTime_idle = (uint32)PPCTimer_tscToMicroseconds(performanceMonitor.gpuTime_idleTime.getPreviousFrameValue()); - uint32 frameTime_dcStageTextures = (uint32)PPCTimer_tscToMicroseconds(performanceMonitor.gpuTime_dcStageTextures.getPreviousFrameValue()); - uint32 frameTime_dcStageVertexMgr = (uint32)PPCTimer_tscToMicroseconds(performanceMonitor.gpuTime_dcStageVertexMgr.getPreviousFrameValue()); - uint32 frameTime_dcStageShaderAndUniformMgr = (uint32)PPCTimer_tscToMicroseconds(performanceMonitor.gpuTime_dcStageShaderAndUniformMgr.getPreviousFrameValue()); - uint32 frameTime_dcStageIndexMgr = (uint32)PPCTimer_tscToMicroseconds(performanceMonitor.gpuTime_dcStageIndexMgr.getPreviousFrameValue()); - uint32 frameTime_dcStageMRT = (uint32)PPCTimer_tscToMicroseconds(performanceMonitor.gpuTime_dcStageMRT.getPreviousFrameValue()); - uint32 frameTime_dcStageDrawcallAPI = (uint32)PPCTimer_tscToMicroseconds(performanceMonitor.gpuTime_dcStageDrawcallAPI.getPreviousFrameValue()); - uint32 frameTime_waitForAsync = (uint32)PPCTimer_tscToMicroseconds(performanceMonitor.gpuTime_waitForAsync.getPreviousFrameValue()); - - // make sure total frame time is not less than it's sums - uint32 minimumExpectedFrametime = - frameTime_idle + - frameTime_dcStageTextures + - frameTime_dcStageVertexMgr + - frameTime_dcStageShaderAndUniformMgr + - frameTime_dcStageIndexMgr + - frameTime_dcStageMRT + - frameTime_dcStageDrawcallAPI + - frameTime_waitForAsync; - frameTime_total = std::max(frameTime_total, minimumExpectedFrametime); - - //g_state.frametimeGraph.appendEntry(); - //g_state.frametimeGraph.setCurrentEntryValue(0xFF404040, frameTime_idle); - //g_state.frametimeGraph.setCurrentEntryValue(0xFFFFC0FF, frameTime_waitForAsync); - //g_state.frametimeGraph.setCurrentEntryValue(0xFF000040, frameTime_dcStageTextures); // dark red - //g_state.frametimeGraph.setCurrentEntryValue(0xFF004000, frameTime_dcStageVertexMgr); // dark green - //g_state.frametimeGraph.setCurrentEntryValue(0xFFFFFF80, frameTime_dcStageShaderAndUniformMgr); // blueish - //g_state.frametimeGraph.setCurrentEntryValue(0xFF800080, frameTime_dcStageIndexMgr); // purple - //g_state.frametimeGraph.setCurrentEntryValue(0xFF00FF00, frameTime_dcStageMRT); // green - //g_state.frametimeGraph.setCurrentEntryValue(0xFF00FFFF, frameTime_dcStageDrawcallAPI); // yellow - //g_state.frametimeGraph.setCurrentEntryValue(0xFFBBBBBB, frameTime_total - minimumExpectedFrametime); -} diff --git a/src/Cafe/HW/Latte/Core/LatteOverlay.h b/src/Cafe/HW/Latte/Core/LatteOverlay.h index 3df83d1d..e497abb0 100644 --- a/src/Cafe/HW/Latte/Core/LatteOverlay.h +++ b/src/Cafe/HW/Latte/Core/LatteOverlay.h @@ -3,6 +3,5 @@ void LatteOverlay_init(); void LatteOverlay_render(bool pad_view); void LatteOverlay_updateStats(double fps, sint32 drawcalls); -void LatteOverlay_updateStatsPerFrame(); void LatteOverlay_pushNotification(const std::string& text, sint32 duration); \ No newline at end of file diff --git a/src/Cafe/HW/Latte/Core/LattePerformanceMonitor.cpp b/src/Cafe/HW/Latte/Core/LattePerformanceMonitor.cpp index 5d6a020b..6bbc7ea4 100644 --- a/src/Cafe/HW/Latte/Core/LattePerformanceMonitor.cpp +++ b/src/Cafe/HW/Latte/Core/LattePerformanceMonitor.cpp @@ -113,7 +113,6 @@ void LattePerformanceMonitor_frameEnd() gui_updateWindowTitles(false, false, fps); } } - LatteOverlay_updateStatsPerFrame(); } void LattePerformanceMonitor_frameBegin() diff --git a/src/Cafe/HW/Latte/Renderer/OpenGL/OpenGLRendererCore.cpp b/src/Cafe/HW/Latte/Renderer/OpenGL/OpenGLRendererCore.cpp index 53d04de5..d5cec237 100644 --- a/src/Cafe/HW/Latte/Renderer/OpenGL/OpenGLRendererCore.cpp +++ b/src/Cafe/HW/Latte/Renderer/OpenGL/OpenGLRendererCore.cpp @@ -1201,20 +1201,10 @@ void OpenGLRenderer::draw_beginSequence() void OpenGLRenderer::draw_execute(uint32 baseVertex, uint32 baseInstance, uint32 instanceCount, uint32 count, MPTR indexDataMPTR, Latte::LATTE_VGT_DMA_INDEX_TYPE::E_INDEX_TYPE indexType, bool isFirst) { bool isMinimal = !isFirst; - if (ActiveSettings::FrameProfilerEnabled()) - { - if (isMinimal) - draw_genericDrawHandler(baseVertex, baseInstance, instanceCount, count, indexDataMPTR, indexType); - else - draw_genericDrawHandler(baseVertex, baseInstance, instanceCount, count, indexDataMPTR, indexType); - } - else - { - if (isMinimal) - draw_genericDrawHandler(baseVertex, baseInstance, instanceCount, count, indexDataMPTR, indexType); - else - draw_genericDrawHandler(baseVertex, baseInstance, instanceCount, count, indexDataMPTR, indexType); - } + if (isMinimal) + draw_genericDrawHandler(baseVertex, baseInstance, instanceCount, count, indexDataMPTR, indexType); + else + draw_genericDrawHandler(baseVertex, baseInstance, instanceCount, count, indexDataMPTR, indexType); } void OpenGLRenderer::draw_endSequence() diff --git a/src/Cafe/OS/libs/coreinit/coreinit.cpp b/src/Cafe/OS/libs/coreinit/coreinit.cpp index f0c0f952..4253bae8 100644 --- a/src/Cafe/OS/libs/coreinit/coreinit.cpp +++ b/src/Cafe/OS/libs/coreinit/coreinit.cpp @@ -115,9 +115,9 @@ void DebugLogStackTrace(OSThread_t* thread, MPTR sp) void coreinitExport_OSPanic(PPCInterpreter_t* hCPU) { - debug_printf("OSPanic!\n"); - debug_printf("File: %s:%d\n", memory_getPointerFromVirtualOffset(hCPU->gpr[3]), hCPU->gpr[4]); - debug_printf("Msg: %s\n", memory_getPointerFromVirtualOffset(hCPU->gpr[5])); + cemuLog_log(LogType::Force, "OSPanic!\n"); + cemuLog_log(LogType::Force, "File: {}:{}\n", (const char*)memory_getPointerFromVirtualOffset(hCPU->gpr[3]), hCPU->gpr[4]); + cemuLog_log(LogType::Force, "Msg: {}\n", (const char*)memory_getPointerFromVirtualOffset(hCPU->gpr[5])); DebugLogStackTrace(coreinit::OSGetCurrentThread(), coreinit::OSGetStackPointer()); #ifdef CEMU_DEBUG_ASSERT assert_dbg(); @@ -271,7 +271,8 @@ namespace coreinit void coreinit_exit(uint32 r) { - cemuLog_log(LogType::Force, "coreinit.exit({})", r); + cemuLog_log(LogType::Force, "The title terminated the process by calling coreinit.exit({})", (sint32)r); + DebugLogStackTrace(coreinit::OSGetCurrentThread(), coreinit::OSGetStackPointer()); cemu_assert_debug(false); // never return while (true) std::this_thread::sleep_for(std::chrono::milliseconds(100)); diff --git a/src/config/ActiveSettings.cpp b/src/config/ActiveSettings.cpp index ff5435bc..af7f521e 100644 --- a/src/config/ActiveSettings.cpp +++ b/src/config/ActiveSettings.cpp @@ -174,16 +174,6 @@ void ActiveSettings::EnableDumpLibcurlRequests(bool state) s_dump_libcurl_requests = state; } -bool ActiveSettings::FrameProfilerEnabled() -{ - return s_frame_profiler_enabled; -} - -void ActiveSettings::EnableFrameProfiler(bool state) -{ - s_frame_profiler_enabled = state; -} - bool ActiveSettings::VPADDelayEnabled() { const uint64 titleId = CafeSystem::GetForegroundTitleId(); diff --git a/src/config/ActiveSettings.h b/src/config/ActiveSettings.h index 678c3966..1b66b525 100644 --- a/src/config/ActiveSettings.h +++ b/src/config/ActiveSettings.h @@ -104,10 +104,6 @@ public: static void EnableDumpTextures(bool state); static void EnableDumpLibcurlRequests(bool state); - // debug - [[nodiscard]] static bool FrameProfilerEnabled(); - static void EnableFrameProfiler(bool state); - // hacks [[nodiscard]] static bool VPADDelayEnabled(); [[nodiscard]] static bool ShaderPreventInfiniteLoopsEnabled(); @@ -124,7 +120,6 @@ private: inline static uint8 s_timer_shift = 3; // right shift factor, 0 -> 8x, 3 -> 1x, 4 -> 0.5x // debug - inline static bool s_frame_profiler_enabled = false; inline static bool s_audio_aux_only = false; inline static bool s_has_required_online_files = false; diff --git a/src/gui/MainWindow.cpp b/src/gui/MainWindow.cpp index 7fe4ec54..a2e229c0 100644 --- a/src/gui/MainWindow.cpp +++ b/src/gui/MainWindow.cpp @@ -139,7 +139,6 @@ enum MAINFRAME_MENU_ID_DEBUG_VIEW_PPC_DEBUGGER, MAINFRAME_MENU_ID_DEBUG_VIEW_AUDIO_DEBUGGER, MAINFRAME_MENU_ID_DEBUG_VIEW_TEXTURE_RELATIONS, - MAINFRAME_MENU_ID_DEBUG_SHOW_FRAME_PROFILER, MAINFRAME_MENU_ID_DEBUG_AUDIO_AUX_ONLY, MAINFRAME_MENU_ID_DEBUG_VK_ACCURATE_BARRIERS, @@ -225,7 +224,6 @@ EVT_MENU(MAINFRAME_MENU_ID_DEBUG_VIEW_PPC_THREADS, MainWindow::OnDebugViewPPCThr EVT_MENU(MAINFRAME_MENU_ID_DEBUG_VIEW_PPC_DEBUGGER, MainWindow::OnDebugViewPPCDebugger) EVT_MENU(MAINFRAME_MENU_ID_DEBUG_VIEW_AUDIO_DEBUGGER, MainWindow::OnDebugViewAudioDebugger) EVT_MENU(MAINFRAME_MENU_ID_DEBUG_VIEW_TEXTURE_RELATIONS, MainWindow::OnDebugViewTextureRelations) -EVT_MENU(MAINFRAME_MENU_ID_DEBUG_SHOW_FRAME_PROFILER, MainWindow::OnDebugSetting) // help menu EVT_MENU(MAINFRAME_MENU_ID_HELP_WEB, MainWindow::OnHelpVistWebpage) EVT_MENU(MAINFRAME_MENU_ID_HELP_ABOUT, MainWindow::OnHelpAbout) @@ -1038,10 +1036,6 @@ void MainWindow::OnDebugSetting(wxCommandEvent& event) wxMessageBox(_("Dump complete")); }*/ } - else if (event.GetId() == MAINFRAME_MENU_ID_DEBUG_SHOW_FRAME_PROFILER) - { - ActiveSettings::EnableFrameProfiler(event.IsChecked()); - } else if (event.GetId() == MAINFRAME_MENU_ID_DEBUG_DUMP_CURL_REQUESTS) { // toggle debug -> dump -> curl requests @@ -2231,7 +2225,6 @@ void MainWindow::RecreateMenu() debugMenu->Append(MAINFRAME_MENU_ID_DEBUG_VIEW_PPC_DEBUGGER, _("&View PPC debugger")); debugMenu->Append(MAINFRAME_MENU_ID_DEBUG_VIEW_AUDIO_DEBUGGER, _("&View audio debugger")); debugMenu->Append(MAINFRAME_MENU_ID_DEBUG_VIEW_TEXTURE_RELATIONS, _("&View texture cache info")); - debugMenu->AppendCheckItem(MAINFRAME_MENU_ID_DEBUG_SHOW_FRAME_PROFILER, _("&Show frame profiler"), wxEmptyString); debugMenu->Append(MAINFRAME_MENU_ID_DEBUG_DUMP_RAM, _("&Dump current RAM")); // debugMenu->Append(MAINFRAME_MENU_ID_DEBUG_DUMP_FST, _("&Dump WUD filesystem"))->Enable(false);