Add key to TimelineItem.

This commit is contained in:
Tomaž Vöröš 2023-01-27 20:00:05 +01:00
parent 2df56e9941
commit dbefb70db3
7 changed files with 13 additions and 8 deletions

View File

@ -8,10 +8,11 @@
namespace tracy namespace tracy
{ {
TimelineItem::TimelineItem( View& view, Worker& worker ) TimelineItem::TimelineItem( View& view, Worker& worker, const void* key )
: m_visible( true ) : m_visible( true )
, m_showFull( true ) , m_showFull( true )
, m_height( 0 ) , m_height( 0 )
, m_key( key )
, m_view( view ) , m_view( view )
, m_worker( worker ) , m_worker( worker )
{ {

View File

@ -14,7 +14,7 @@ class Worker;
class TimelineItem class TimelineItem
{ {
public: public:
TimelineItem( View& view, Worker& worker ); TimelineItem( View& view, Worker& worker, const void* key );
virtual ~TimelineItem() = default; virtual ~TimelineItem() = default;
// draws the timeilne item and also updates the next frame height value // draws the timeilne item and also updates the next frame height value
@ -29,6 +29,8 @@ public:
// returns 0 instead of the correct value for the first frame // returns 0 instead of the correct value for the first frame
int GetNextFrameHeight() const { return m_height; } int GetNextFrameHeight() const { return m_height; }
const void* GetKey() const { return m_key; }
protected: protected:
virtual uint32_t HeaderColor() const = 0; virtual uint32_t HeaderColor() const = 0;
virtual uint32_t HeaderColorInactive() const = 0; virtual uint32_t HeaderColorInactive() const = 0;
@ -54,6 +56,8 @@ private:
int m_height; int m_height;
const void* m_key;
protected: protected:
View& m_view; View& m_view;
Worker& m_worker; Worker& m_worker;

View File

@ -8,8 +8,8 @@
namespace tracy namespace tracy
{ {
TimelineItemCpuData::TimelineItemCpuData( View& view, Worker& worker, void* ) TimelineItemCpuData::TimelineItemCpuData( View& view, Worker& worker, void* key )
: TimelineItem( view, worker ) : TimelineItem( view, worker, key )
{ {
} }

View File

@ -10,7 +10,7 @@ namespace tracy
class TimelineItemCpuData final : public TimelineItem class TimelineItemCpuData final : public TimelineItem
{ {
public: public:
TimelineItemCpuData( View& view, Worker& worker, void* ); TimelineItemCpuData( View& view, Worker& worker, void* key );
void SetVisible( bool visible ) override; void SetVisible( bool visible ) override;
bool IsVisible() const override; bool IsVisible() const override;

View File

@ -10,7 +10,7 @@ namespace tracy
{ {
TimelineItemGpu::TimelineItemGpu( View& view, Worker& worker, GpuCtxData* gpu ) TimelineItemGpu::TimelineItemGpu( View& view, Worker& worker, GpuCtxData* gpu )
: TimelineItem( view, worker ) : TimelineItem( view, worker, gpu )
, m_gpu( gpu ) , m_gpu( gpu )
, m_idx( view.GetNextGpuIdx() ) , m_idx( view.GetNextGpuIdx() )
{ {

View File

@ -9,7 +9,7 @@ namespace tracy
{ {
TimelineItemPlot::TimelineItemPlot( View& view, Worker& worker, PlotData* plot ) TimelineItemPlot::TimelineItemPlot( View& view, Worker& worker, PlotData* plot )
: TimelineItem( view, worker ) : TimelineItem( view, worker, plot )
, m_plot( plot ) , m_plot( plot )
{ {
} }

View File

@ -12,7 +12,7 @@ namespace tracy
{ {
TimelineItemThread::TimelineItemThread( View& view, Worker& worker, const ThreadData* thread ) TimelineItemThread::TimelineItemThread( View& view, Worker& worker, const ThreadData* thread )
: TimelineItem( view, worker ) : TimelineItem( view, worker, thread )
, m_thread( thread ) , m_thread( thread )
, m_ghost( false ) , m_ghost( false )
{ {