mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-10 02:31:48 +00:00
Allow forceful insertion into main thread queue.
This is useful to run some tasks outside of the main render job.
This commit is contained in:
parent
89ca010146
commit
902de497dc
@ -130,9 +130,9 @@ static uint32_t updateVersion = 0;
|
||||
static bool showReleaseNotes = false;
|
||||
static std::string releaseNotes;
|
||||
|
||||
void RunOnMainThread( std::function<void()> cb )
|
||||
void RunOnMainThread( std::function<void()> cb, bool forceDelay = false )
|
||||
{
|
||||
if( std::this_thread::get_id() == mainThread )
|
||||
if( !forceDelay && std::this_thread::get_id() == mainThread )
|
||||
{
|
||||
cb();
|
||||
}
|
||||
|
@ -22,10 +22,10 @@ void* MakeTexture()
|
||||
return (void*)(intptr_t)tex;
|
||||
}
|
||||
|
||||
void FreeTexture( void* _tex, void(*runOnMainThread)(std::function<void()>) )
|
||||
void FreeTexture( void* _tex, void(*runOnMainThread)(std::function<void()>, 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 )
|
||||
|
@ -7,7 +7,7 @@ namespace tracy
|
||||
{
|
||||
|
||||
void* MakeTexture();
|
||||
void FreeTexture( void* tex, void(*runOnMainThread)(std::function<void()>) );
|
||||
void FreeTexture( void* tex, void(*runOnMainThread)(std::function<void()>, bool) );
|
||||
void UpdateTexture( void* tex, const char* data, int w, int h );
|
||||
|
||||
}
|
||||
|
@ -134,7 +134,7 @@ enum { MinFrameSize = 5 };
|
||||
|
||||
static View* s_instance = nullptr;
|
||||
|
||||
View::View( void(*cbMainThread)(std::function<void()>), const char* addr, uint16_t port, ImFont* fixedWidth, ImFont* smallFont, ImFont* bigFont, SetTitleCallback stcb, GetWindowCallback gwcb, SetScaleCallback sscb )
|
||||
View::View( void(*cbMainThread)(std::function<void()>, 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<void()>), const char* addr, uint16
|
||||
InitTextEditor( fixedWidth );
|
||||
}
|
||||
|
||||
View::View( void(*cbMainThread)(std::function<void()>), FileRead& f, ImFont* fixedWidth, ImFont* smallFont, ImFont* bigFont, SetTitleCallback stcb, GetWindowCallback gwcb, SetScaleCallback sscb )
|
||||
View::View( void(*cbMainThread)(std::function<void()>, 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 )
|
||||
|
@ -92,9 +92,9 @@ public:
|
||||
using GetWindowCallback = void*(*)();
|
||||
using SetScaleCallback = void(*)( float, ImFont*&, ImFont*&, ImFont*& );
|
||||
|
||||
View( void(*cbMainThread)(std::function<void()>), 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<void()>), 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<void()>), 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<void()>, 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<void()>, 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<void()>, 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<int16_t, StatisticsCache> m_statCache;
|
||||
|
||||
void(*m_cbMainThread)(std::function<void()>);
|
||||
void(*m_cbMainThread)(std::function<void()>, bool);
|
||||
|
||||
struct FindZone {
|
||||
enum : uint64_t { Unselected = std::numeric_limits<uint64_t>::max() - 1 };
|
||||
|
Loading…
Reference in New Issue
Block a user