From c21170cc01e5aed31fced2c481e82e58f0e98840 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Fri, 29 Mar 2024 21:54:31 +0100 Subject: [PATCH] Add config option for reduced render rate. --- profiler/src/main.cpp | 5 +++++ profiler/src/profiler/TracyConfig.hpp | 1 + 2 files changed, 6 insertions(+) diff --git a/profiler/src/main.cpp b/profiler/src/main.cpp index 929e04f7..78e71dd7 100644 --- a/profiler/src/main.cpp +++ b/profiler/src/main.cpp @@ -211,6 +211,7 @@ static void LoadConfig() int v; if( ini_sget( ini, "core", "threadedRendering", "%d", &v ) ) s_config.threadedRendering = v; + if( ini_sget( ini, "core", "focusLostLimit", "%d", &v ) ) s_config.focusLostLimit = v; if( ini_sget( ini, "timeline", "targetFps", "%d", &v ) && v >= 1 && v < 10000 ) s_config.targetFps = v; ini_free( ini ); @@ -224,6 +225,7 @@ static bool SaveConfig() fprintf( f, "[core]\n" ); fprintf( f, "threadedRendering = %i\n", (int)s_config.threadedRendering ); + fprintf( f, "focusLostLimit = %i\n", (int)s_config.focusLostLimit ); fprintf( f, "\n[timeline]\n" ); fprintf( f, "targetFps = %i\n", s_config.targetFps ); @@ -658,6 +660,9 @@ static void DrawContents() tracy::DrawHelpMarker( "Restricts rendering to a single CPU core. Can reduce profiler frame rate." ); ImGui::Unindent(); + ImGui::Spacing(); + if( ImGui::Checkbox( "Reduce render rate when focus is lost", &s_config.focusLostLimit ) ) SaveConfig(); + ImGui::Spacing(); ImGui::TextUnformatted( "Target FPS" ); ImGui::SameLine(); diff --git a/profiler/src/profiler/TracyConfig.hpp b/profiler/src/profiler/TracyConfig.hpp index 2f40c504..ac2e1181 100644 --- a/profiler/src/profiler/TracyConfig.hpp +++ b/profiler/src/profiler/TracyConfig.hpp @@ -7,6 +7,7 @@ namespace tracy struct Config { bool threadedRendering = true; + bool focusLostLimit = true; int targetFps = 60; };