diff --git a/manual/tracy.tex b/manual/tracy.tex index dc7ebfde..e5171801 100644 --- a/manual/tracy.tex +++ b/manual/tracy.tex @@ -3795,6 +3795,9 @@ Function names in the remaining places across the UI will be normalized unless t Disabling the display of some events is especially recommended when the profiler performance drops below acceptable levels for interactive usage. +It is possible to store defaults for certain settings to the global Tracy configuration file. +This can be done using the \emph{Save defaults} button at the bottom of the window, or by manually editing this configuration file indicated in the tooltip. + \subsection{Messages window} \label{messages} diff --git a/profiler/src/profiler/TracyConfig.hpp b/profiler/src/profiler/TracyConfig.hpp index 7a7455e3..e2a86c5b 100644 --- a/profiler/src/profiler/TracyConfig.hpp +++ b/profiler/src/profiler/TracyConfig.hpp @@ -23,8 +23,12 @@ struct Config bool forceColors = false; bool ghostZones = true; int shortenName = (int)ShortenName::NoSpaceAndNormalize; + bool drawSamples = true; + bool drawContextSwitches = true; bool saveUserScale = false; float userScale = 1.0f; + + // LLM assistant settings #ifdef __EMSCRIPTEN__ bool llm = false; #else diff --git a/profiler/src/profiler/TracyView.cpp b/profiler/src/profiler/TracyView.cpp index f9786ec1..d2e17884 100644 --- a/profiler/src/profiler/TracyView.cpp +++ b/profiler/src/profiler/TracyView.cpp @@ -135,11 +135,14 @@ void View::InitTextEditor() void View::SetupConfig() { + // Keep in sync with TracyView_Options.cpp View::DrawOptions(), bottom of the file. m_vd.frameTarget = s_config.targetFps; m_vd.dynamicColors = s_config.dynamicColors; m_vd.forceColors = s_config.forceColors; m_vd.ghostZones = s_config.ghostZones; m_vd.shortenName = (ShortenName)s_config.shortenName; + m_vd.drawSamples = s_config.drawSamples; + m_vd.drawContextSwitches = s_config.drawContextSwitches; } void View::Achieve( const char* id ) diff --git a/profiler/src/profiler/TracyView_Options.cpp b/profiler/src/profiler/TracyView_Options.cpp index 321e41ce..2b0ee97e 100644 --- a/profiler/src/profiler/TracyView_Options.cpp +++ b/profiler/src/profiler/TracyView_Options.cpp @@ -8,6 +8,7 @@ #include "TracyTimelineItemGpu.hpp" #include "TracyUtility.hpp" #include "TracyView.hpp" +#include "TracyStorage.hpp" #include "tracy_pdqsort.h" #include "../Fonts.hpp" @@ -824,6 +825,34 @@ void View::DrawOptions() ImGui::TreePop(); } } + + ImGui::Spacing(); + if( ImGui::Button( "Save defaults" ) ) + { + // Keep in sync with TracyView.cpp View::SetupConfig() + s_config.targetFps = m_vd.frameTarget; + s_config.dynamicColors = m_vd.dynamicColors; + s_config.forceColors = m_vd.forceColors; + s_config.ghostZones = m_vd.ghostZones; + s_config.shortenName = (int)m_vd.shortenName; + s_config.drawSamples = m_vd.drawSamples; + s_config.drawContextSwitches = m_vd.drawContextSwitches; + SaveConfig(); + } + if( ImGui::IsItemHovered() ) + { + ImGui::BeginTooltip(); + const auto fn = tracy::GetSavePath( "tracy.ini" ); + ImGui::TextUnformatted( + "A handful of the options above have configurable default values.\n" + "There is no UI yet to set those items, except this button which saves the default for all of them.\n\n" + "For now, you can also manually adjust those defaults by editing the config file at:" + ); + TextDisabledUnformatted(fn); + ImGui::EndTooltip(); + + } + ImGui::End(); }