diff --git a/profiler/src/main.cpp b/profiler/src/main.cpp index ceaed73b..a84b839c 100644 --- a/profiler/src/main.cpp +++ b/profiler/src/main.cpp @@ -130,9 +130,9 @@ static uint32_t updateVersion = 0; static bool showReleaseNotes = false; static std::string releaseNotes; -void RunOnMainThread( std::function cb ) +void RunOnMainThread( std::function cb, bool forceDelay = false ) { - if( std::this_thread::get_id() == mainThread ) + if( !forceDelay && std::this_thread::get_id() == mainThread ) { cb(); } diff --git a/server/TracyTexture.cpp b/server/TracyTexture.cpp index 097a460e..cdc2e489 100644 --- a/server/TracyTexture.cpp +++ b/server/TracyTexture.cpp @@ -22,10 +22,10 @@ void* MakeTexture() return (void*)(intptr_t)tex; } -void FreeTexture( void* _tex, void(*runOnMainThread)(std::function) ) +void FreeTexture( void* _tex, void(*runOnMainThread)(std::function, bool) ) { auto tex = (GLuint)(intptr_t)_tex; - runOnMainThread( [tex] { glDeleteTextures( 1, &tex ); } ); + runOnMainThread( [tex] { glDeleteTextures( 1, &tex ); }, false ); } void UpdateTexture( void* _tex, const char* data, int w, int h ) diff --git a/server/TracyTexture.hpp b/server/TracyTexture.hpp index fbaa5d62..24cdab69 100644 --- a/server/TracyTexture.hpp +++ b/server/TracyTexture.hpp @@ -7,7 +7,7 @@ namespace tracy { void* MakeTexture(); -void FreeTexture( void* tex, void(*runOnMainThread)(std::function) ); +void FreeTexture( void* tex, void(*runOnMainThread)(std::function, bool) ); void UpdateTexture( void* tex, const char* data, int w, int h ); } diff --git a/server/TracyView.cpp b/server/TracyView.cpp index 633e5f09..9249552b 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -134,7 +134,7 @@ enum { MinFrameSize = 5 }; static View* s_instance = nullptr; -View::View( void(*cbMainThread)(std::function), const char* addr, uint16_t port, ImFont* fixedWidth, ImFont* smallFont, ImFont* bigFont, SetTitleCallback stcb, GetWindowCallback gwcb, SetScaleCallback sscb ) +View::View( void(*cbMainThread)(std::function, bool), const char* addr, uint16_t port, ImFont* fixedWidth, ImFont* smallFont, ImFont* bigFont, SetTitleCallback stcb, GetWindowCallback gwcb, SetScaleCallback sscb ) : m_worker( addr, port ) , m_staticView( false ) , m_viewMode( ViewMode::LastFrames ) @@ -160,7 +160,7 @@ View::View( void(*cbMainThread)(std::function), const char* addr, uint16 InitTextEditor( fixedWidth ); } -View::View( void(*cbMainThread)(std::function), FileRead& f, ImFont* fixedWidth, ImFont* smallFont, ImFont* bigFont, SetTitleCallback stcb, GetWindowCallback gwcb, SetScaleCallback sscb ) +View::View( void(*cbMainThread)(std::function, bool), FileRead& f, ImFont* fixedWidth, ImFont* smallFont, ImFont* bigFont, SetTitleCallback stcb, GetWindowCallback gwcb, SetScaleCallback sscb ) : m_worker( f ) , m_filename( f.GetFilename() ) , m_staticView( true ) diff --git a/server/TracyView.hpp b/server/TracyView.hpp index f4b02af7..9dbbb886 100644 --- a/server/TracyView.hpp +++ b/server/TracyView.hpp @@ -92,9 +92,9 @@ public: using GetWindowCallback = void*(*)(); using SetScaleCallback = void(*)( float, ImFont*&, ImFont*&, ImFont*& ); - View( void(*cbMainThread)(std::function), ImFont* fixedWidth = nullptr, ImFont* smallFont = nullptr, ImFont* bigFont = nullptr, SetTitleCallback stcb = nullptr, GetWindowCallback gwcb = nullptr, SetScaleCallback sscb = nullptr ) : View( cbMainThread, "127.0.0.1", 8086, fixedWidth, smallFont, bigFont, stcb, gwcb, sscb ) {} - View( void(*cbMainThread)(std::function), const char* addr, uint16_t port, ImFont* fixedWidth = nullptr, ImFont* smallFont = nullptr, ImFont* bigFont = nullptr, SetTitleCallback stcb = nullptr, GetWindowCallback gwcb = nullptr, SetScaleCallback sscb = nullptr ); - View( void(*cbMainThread)(std::function), FileRead& f, ImFont* fixedWidth = nullptr, ImFont* smallFont = nullptr, ImFont* bigFont = nullptr, SetTitleCallback stcb = nullptr, GetWindowCallback gwcb = nullptr, SetScaleCallback sscb = nullptr ); + View( void(*cbMainThread)(std::function, bool), ImFont* fixedWidth = nullptr, ImFont* smallFont = nullptr, ImFont* bigFont = nullptr, SetTitleCallback stcb = nullptr, GetWindowCallback gwcb = nullptr, SetScaleCallback sscb = nullptr ) : View( cbMainThread, "127.0.0.1", 8086, fixedWidth, smallFont, bigFont, stcb, gwcb, sscb ) {} + View( void(*cbMainThread)(std::function, bool), const char* addr, uint16_t port, ImFont* fixedWidth = nullptr, ImFont* smallFont = nullptr, ImFont* bigFont = nullptr, SetTitleCallback stcb = nullptr, GetWindowCallback gwcb = nullptr, SetScaleCallback sscb = nullptr ); + View( void(*cbMainThread)(std::function, bool), FileRead& f, ImFont* fixedWidth = nullptr, ImFont* smallFont = nullptr, ImFont* bigFont = nullptr, SetTitleCallback stcb = nullptr, GetWindowCallback gwcb = nullptr, SetScaleCallback sscb = nullptr ); ~View(); static bool Draw(); @@ -531,7 +531,7 @@ private: unordered_flat_map m_statCache; - void(*m_cbMainThread)(std::function); + void(*m_cbMainThread)(std::function, bool); struct FindZone { enum : uint64_t { Unselected = std::numeric_limits::max() - 1 };