mirror of
https://github.com/wolfpld/tracy.git
synced 2024-09-20 05:42:18 +00:00
Add persistent target FPS option.
This commit is contained in:
parent
3150a48561
commit
bd2f903c08
@ -169,6 +169,7 @@ static void LoadConfig()
|
||||
|
||||
int v;
|
||||
if( ini_sget( ini, "core", "threadedRendering", "%d", &v ) ) s_config.threadedRendering = v;
|
||||
if( ini_sget( ini, "timeline", "targetFps", "%d", &v ) && v >= 1 && v < 10000 ) s_config.targetFps = v;
|
||||
|
||||
ini_free( ini );
|
||||
}
|
||||
@ -182,6 +183,9 @@ static bool SaveConfig()
|
||||
fprintf( f, "[core]\n" );
|
||||
fprintf( f, "threadedRendering = %i\n", (int)s_config.threadedRendering );
|
||||
|
||||
fprintf( f, "\n[timeline]\n" );
|
||||
fprintf( f, "targetFps = %i\n", s_config.targetFps );
|
||||
|
||||
fclose( f );
|
||||
return true;
|
||||
}
|
||||
@ -553,17 +557,24 @@ static void DrawContents()
|
||||
ImGui::Separator();
|
||||
if( ImGui::TreeNode( ICON_FA_TOOLBOX " Global settings" ) )
|
||||
{
|
||||
ImGui::PushStyleVar( ImGuiStyleVar_FramePadding, ImVec2( 0, 0 ) );
|
||||
ImGui::TextUnformatted( "Threaded rendering" );
|
||||
ImGui::Indent();
|
||||
ImGui::PushStyleVar( ImGuiStyleVar_FramePadding, ImVec2( 0, 0 ) );
|
||||
if( ImGui::RadioButton( "Enabled", s_config.threadedRendering ) ) { s_config.threadedRendering = true; SaveConfig(); }
|
||||
ImGui::SameLine();
|
||||
tracy::DrawHelpMarker( "Uses all available CPU cores for rendering. May affect performance of the profiled application when running on the same machine." );
|
||||
if( ImGui::RadioButton( "Disabled", !s_config.threadedRendering ) ) { s_config.threadedRendering = false; SaveConfig(); }
|
||||
ImGui::SameLine();
|
||||
tracy::DrawHelpMarker( "Restricts rendering to a single CPU core. Can reduce profiler frame rate." );
|
||||
ImGui::PopStyleVar();
|
||||
ImGui::Unindent();
|
||||
|
||||
ImGui::Spacing();
|
||||
ImGui::TextUnformatted( "Target FPS" );
|
||||
ImGui::SameLine();
|
||||
int tmp = s_config.targetFps;
|
||||
ImGui::SetNextItemWidth( 90 * dpiScale );
|
||||
if( ImGui::InputInt( "##targetfps", &tmp ) ) { s_config.targetFps = std::clamp( tmp, 1, 9999 ); SaveConfig(); }
|
||||
ImGui::PopStyleVar();
|
||||
ImGui::TreePop();
|
||||
}
|
||||
ImGui::Separator();
|
||||
|
@ -7,6 +7,7 @@ namespace tracy
|
||||
struct Config
|
||||
{
|
||||
bool threadedRendering = true;
|
||||
int targetFps = 60;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -66,6 +66,8 @@ View::View( void(*cbMainThread)(const std::function<void()>&, bool), const char*
|
||||
{
|
||||
InitMemory();
|
||||
InitTextEditor();
|
||||
|
||||
m_vd.frameTarget = config.targetFps;
|
||||
}
|
||||
|
||||
View::View( void(*cbMainThread)(const std::function<void()>&, bool), FileRead& f, ImFont* fixedWidth, ImFont* smallFont, ImFont* bigFont, SetTitleCallback stcb, SetScaleCallback sscb, AttentionCallback acb, const Config& config )
|
||||
@ -99,6 +101,8 @@ View::View( void(*cbMainThread)(const std::function<void()>&, bool), FileRead& f
|
||||
|
||||
if( m_worker.GetCallstackFrameCount() == 0 ) m_showUnknownFrames = false;
|
||||
if( m_worker.GetCallstackSampleCount() == 0 ) m_showAllSymbols = true;
|
||||
|
||||
m_vd.frameTarget = config.targetFps;
|
||||
}
|
||||
|
||||
View::~View()
|
||||
|
Loading…
Reference in New Issue
Block a user