mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-27 00:04:35 +00:00
Don't draw off-screen zone timeline labels.
This commit is contained in:
parent
84fd351fba
commit
723fad84a7
@ -879,6 +879,9 @@ void View::DrawZones()
|
|||||||
const auto to = 9.f;
|
const auto to = 9.f;
|
||||||
const auto th = ( ty - to ) * sqrt( 3 ) * 0.5;
|
const auto th = ( ty - to ) * sqrt( 3 ) * 0.5;
|
||||||
|
|
||||||
|
const auto yMin = linepos.y;
|
||||||
|
const auto yMax = yMin + lineh;
|
||||||
|
|
||||||
// gpu zones
|
// gpu zones
|
||||||
if( m_drawGpuZones )
|
if( m_drawGpuZones )
|
||||||
{
|
{
|
||||||
@ -886,45 +889,49 @@ void View::DrawZones()
|
|||||||
{
|
{
|
||||||
const auto& v = m_worker.GetGpuData()[i];
|
const auto& v = m_worker.GetGpuData()[i];
|
||||||
if( !Visible( v ) ) continue;
|
if( !Visible( v ) ) continue;
|
||||||
|
|
||||||
draw->AddLine( wpos + ImVec2( 0, offset + ostep - 1 ), wpos + ImVec2( w, offset + ostep - 1 ), 0x33FFFFFF );
|
|
||||||
|
|
||||||
bool& showFull = ShowFull( v );
|
bool& showFull = ShowFull( v );
|
||||||
if( showFull )
|
|
||||||
{
|
|
||||||
draw->AddTriangleFilled( wpos + ImVec2( to/2, offset + to/2 ), wpos + ImVec2( ty - to/2, offset + to/2 ), wpos + ImVec2( ty * 0.5, offset + to/2 + th ), 0xFFFFAAAA );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
draw->AddTriangle( wpos + ImVec2( to/2, offset + to/2 ), wpos + ImVec2( to/2, offset + ty - to/2 ), wpos + ImVec2( to/2 + th, offset + ty * 0.5 ), 0xFF886666 );
|
|
||||||
}
|
|
||||||
char buf[64];
|
|
||||||
sprintf( buf, "GPU context %zu", i );
|
|
||||||
draw->AddText( wpos + ImVec2( ty, offset ), showFull ? 0xFFFFAAAA : 0xFF886666, buf );
|
|
||||||
|
|
||||||
if( hover && ImGui::IsMouseHoveringRect( wpos + ImVec2( 0, offset ), wpos + ImVec2( ty + ImGui::CalcTextSize( buf ).x, offset + ty ) ) )
|
const auto yPos = wpos.y + offset;
|
||||||
|
if( yPos + ostep >= yMin && yPos <= yMax )
|
||||||
{
|
{
|
||||||
if( ImGui::IsMouseClicked( 0 ) )
|
draw->AddLine( wpos + ImVec2( 0, offset + ostep - 1 ), wpos + ImVec2( w, offset + ostep - 1 ), 0x33FFFFFF );
|
||||||
|
|
||||||
|
if( showFull )
|
||||||
{
|
{
|
||||||
showFull = !showFull;
|
draw->AddTriangleFilled( wpos + ImVec2( to/2, offset + to/2 ), wpos + ImVec2( ty - to/2, offset + to/2 ), wpos + ImVec2( ty * 0.5, offset + to/2 + th ), 0xFFFFAAAA );
|
||||||
}
|
}
|
||||||
|
else
|
||||||
ImGui::BeginTooltip();
|
|
||||||
ImGui::Text( "%s", buf );
|
|
||||||
ImGui::Separator();
|
|
||||||
ImGui::Text( "Thread: %s", m_worker.GetThreadString( v->thread ) );
|
|
||||||
if( !v->timeline.empty() )
|
|
||||||
{
|
{
|
||||||
const auto t = v->timeline.front()->gpuStart;
|
draw->AddTriangle( wpos + ImVec2( to/2, offset + to/2 ), wpos + ImVec2( to/2, offset + ty - to/2 ), wpos + ImVec2( to/2 + th, offset + ty * 0.5 ), 0xFF886666 );
|
||||||
if( t != std::numeric_limits<int64_t>::max() )
|
}
|
||||||
|
char buf[64];
|
||||||
|
sprintf( buf, "GPU context %zu", i );
|
||||||
|
draw->AddText( wpos + ImVec2( ty, offset ), showFull ? 0xFFFFAAAA : 0xFF886666, buf );
|
||||||
|
|
||||||
|
if( hover && ImGui::IsMouseHoveringRect( wpos + ImVec2( 0, offset ), wpos + ImVec2( ty + ImGui::CalcTextSize( buf ).x, offset + ty ) ) )
|
||||||
|
{
|
||||||
|
if( ImGui::IsMouseClicked( 0 ) )
|
||||||
{
|
{
|
||||||
ImGui::Text( "Appeared at %s", TimeToString( t - m_worker.GetFrameTime( 0 ) ) );
|
showFull = !showFull;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ImGui::BeginTooltip();
|
||||||
|
ImGui::Text( "%s", buf );
|
||||||
|
ImGui::Separator();
|
||||||
|
ImGui::Text( "Thread: %s", m_worker.GetThreadString( v->thread ) );
|
||||||
|
if( !v->timeline.empty() )
|
||||||
|
{
|
||||||
|
const auto t = v->timeline.front()->gpuStart;
|
||||||
|
if( t != std::numeric_limits<int64_t>::max() )
|
||||||
|
{
|
||||||
|
ImGui::Text( "Appeared at %s", TimeToString( t - m_worker.GetFrameTime( 0 ) ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ImGui::Text( "Zone count: %s", RealToString( v->count, true ) );
|
||||||
|
ImGui::Text( "Top-level zones: %s", RealToString( v->timeline.size(), true ) );
|
||||||
|
ImGui::Text( "Query accuracy bits: %i", v->accuracyBits );
|
||||||
|
ImGui::EndTooltip();
|
||||||
}
|
}
|
||||||
ImGui::Text( "Zone count: %s", RealToString( v->count, true ) );
|
|
||||||
ImGui::Text( "Top-level zones: %s", RealToString( v->timeline.size(), true ) );
|
|
||||||
ImGui::Text( "Query accuracy bits: %i", v->accuracyBits );
|
|
||||||
ImGui::EndTooltip();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
offset += ostep;
|
offset += ostep;
|
||||||
@ -942,84 +949,87 @@ void View::DrawZones()
|
|||||||
for( const auto& v : m_worker.GetThreadData() )
|
for( const auto& v : m_worker.GetThreadData() )
|
||||||
{
|
{
|
||||||
if( !Visible( v ) ) continue;
|
if( !Visible( v ) ) continue;
|
||||||
|
|
||||||
draw->AddLine( wpos + ImVec2( 0, offset + ostep - 1 ), wpos + ImVec2( w, offset + ostep - 1 ), 0x33FFFFFF );
|
|
||||||
|
|
||||||
bool& showFull = ShowFull( v );
|
bool& showFull = ShowFull( v );
|
||||||
if( showFull )
|
|
||||||
|
const auto yPos = wpos.y + offset;
|
||||||
|
if( yPos + ostep >= yMin && yPos <= yMax )
|
||||||
{
|
{
|
||||||
draw->AddTriangleFilled( wpos + ImVec2( to/2, offset + to/2 ), wpos + ImVec2( ty - to/2, offset + to/2 ), wpos + ImVec2( ty * 0.5, offset + to/2 + th ), 0xFFFFFFFF );
|
draw->AddLine( wpos + ImVec2( 0, offset + ostep - 1 ), wpos + ImVec2( w, offset + ostep - 1 ), 0x33FFFFFF );
|
||||||
|
|
||||||
auto it = std::lower_bound( v->messages.begin(), v->messages.end(), m_zvStart, [] ( const auto& lhs, const auto& rhs ) { return lhs->time < rhs; } );
|
if( showFull )
|
||||||
auto end = std::lower_bound( it, v->messages.end(), m_zvEnd, [] ( const auto& lhs, const auto& rhs ) { return lhs->time < rhs; } );
|
|
||||||
|
|
||||||
while( it < end )
|
|
||||||
{
|
{
|
||||||
const auto next = std::upper_bound( it, v->messages.end(), (*it)->time + MinVisSize * nspx, [] ( const auto& lhs, const auto& rhs ) { return lhs < rhs->time; } );
|
draw->AddTriangleFilled( wpos + ImVec2( to/2, offset + to/2 ), wpos + ImVec2( ty - to/2, offset + to/2 ), wpos + ImVec2( ty * 0.5, offset + to/2 + th ), 0xFFFFFFFF );
|
||||||
const auto dist = std::distance( it, next );
|
|
||||||
|
|
||||||
const auto px = ( (*it)->time - m_zvStart ) * pxns;
|
auto it = std::lower_bound( v->messages.begin(), v->messages.end(), m_zvStart, [] ( const auto& lhs, const auto& rhs ) { return lhs->time < rhs; } );
|
||||||
if( dist > 1 )
|
auto end = std::lower_bound( it, v->messages.end(), m_zvEnd, [] ( const auto& lhs, const auto& rhs ) { return lhs->time < rhs; } );
|
||||||
|
|
||||||
|
while( it < end )
|
||||||
{
|
{
|
||||||
draw->AddTriangleFilled( wpos + ImVec2( px - (ty - to) * 0.5, offset + to ), wpos + ImVec2( px + (ty - to) * 0.5, offset + to ), wpos + ImVec2( px, offset + to + th ), 0xFFDDDDDD );
|
const auto next = std::upper_bound( it, v->messages.end(), (*it)->time + MinVisSize * nspx, [] ( const auto& lhs, const auto& rhs ) { return lhs < rhs->time; } );
|
||||||
}
|
const auto dist = std::distance( it, next );
|
||||||
draw->AddTriangle( wpos + ImVec2( px - (ty - to) * 0.5, offset + to ), wpos + ImVec2( px + (ty - to) * 0.5, offset + to ), wpos + ImVec2( px, offset + to + th ), 0xFFDDDDDD );
|
|
||||||
if( hover && ImGui::IsMouseHoveringRect( wpos + ImVec2( px - (ty - to) * 0.5 - 1, offset ), wpos + ImVec2( px + (ty - to) * 0.5 + 1, offset + ty ) ) )
|
const auto px = ( (*it)->time - m_zvStart ) * pxns;
|
||||||
{
|
|
||||||
ImGui::BeginTooltip();
|
|
||||||
if( dist > 1 )
|
if( dist > 1 )
|
||||||
{
|
{
|
||||||
ImGui::Text( "%i messages", (int)dist );
|
draw->AddTriangleFilled( wpos + ImVec2( px - (ty - to) * 0.5, offset + to ), wpos + ImVec2( px + (ty - to) * 0.5, offset + to ), wpos + ImVec2( px, offset + to + th ), 0xFFDDDDDD );
|
||||||
}
|
}
|
||||||
else
|
draw->AddTriangle( wpos + ImVec2( px - (ty - to) * 0.5, offset + to ), wpos + ImVec2( px + (ty - to) * 0.5, offset + to ), wpos + ImVec2( px, offset + to + th ), 0xFFDDDDDD );
|
||||||
|
if( hover && ImGui::IsMouseHoveringRect( wpos + ImVec2( px - (ty - to) * 0.5 - 1, offset ), wpos + ImVec2( px + (ty - to) * 0.5 + 1, offset + ty ) ) )
|
||||||
{
|
{
|
||||||
ImGui::Text( "%s", TimeToString( (*it)->time - m_worker.GetFrameBegin( 0 ) ) );
|
ImGui::BeginTooltip();
|
||||||
ImGui::Separator();
|
if( dist > 1 )
|
||||||
ImGui::Text( "Message text:" );
|
{
|
||||||
ImGui::TextColored( ImVec4( 0xCC / 255.f, 0xCC / 255.f, 0x22 / 255.f, 1.f ), "%s", m_worker.GetString( (*it)->ref ) );
|
ImGui::Text( "%i messages", (int)dist );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ImGui::Text( "%s", TimeToString( (*it)->time - m_worker.GetFrameBegin( 0 ) ) );
|
||||||
|
ImGui::Separator();
|
||||||
|
ImGui::Text( "Message text:" );
|
||||||
|
ImGui::TextColored( ImVec4( 0xCC / 255.f, 0xCC / 255.f, 0x22 / 255.f, 1.f ), "%s", m_worker.GetString( (*it)->ref ) );
|
||||||
|
}
|
||||||
|
ImGui::EndTooltip();
|
||||||
|
m_msgHighlight = *it;
|
||||||
}
|
}
|
||||||
ImGui::EndTooltip();
|
it = next;
|
||||||
m_msgHighlight = *it;
|
|
||||||
}
|
}
|
||||||
it = next;
|
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
else
|
|
||||||
{
|
|
||||||
draw->AddTriangle( wpos + ImVec2( to/2, offset + to/2 ), wpos + ImVec2( to/2, offset + ty - to/2 ), wpos + ImVec2( to/2 + th, offset + ty * 0.5 ), 0xFF888888 );
|
|
||||||
}
|
|
||||||
const auto txt = m_worker.GetThreadString( v->id );
|
|
||||||
const auto txtsz = ImGui::CalcTextSize( txt );
|
|
||||||
if( m_gpuThread == v->id )
|
|
||||||
{
|
|
||||||
draw->AddRectFilled( wpos + ImVec2( 0, offset ), wpos + ImVec2( ty + txtsz.x + 4, offset + ty ), 0x448888DD );
|
|
||||||
draw->AddRect( wpos + ImVec2( 0, offset ), wpos + ImVec2( ty + txtsz.x + 4, offset + ty ), 0x888888DD );
|
|
||||||
}
|
|
||||||
if( m_gpuInfoWindow && m_gpuInfoWindowThread == v->id )
|
|
||||||
{
|
|
||||||
draw->AddRectFilled( wpos + ImVec2( 0, offset ), wpos + ImVec2( ty + txtsz.x + 4, offset + ty ), 0x4488DD88 );
|
|
||||||
draw->AddRect( wpos + ImVec2( 0, offset ), wpos + ImVec2( ty + txtsz.x + 4, offset + ty ), 0x8888DD88 );
|
|
||||||
}
|
|
||||||
draw->AddText( wpos + ImVec2( ty, offset ), showFull ? 0xFFFFFFFF : 0xFF888888, txt );
|
|
||||||
|
|
||||||
if( hover && ImGui::IsMouseHoveringRect( wpos + ImVec2( 0, offset ), wpos + ImVec2( ty + txtsz.x, offset + ty ) ) )
|
|
||||||
{
|
|
||||||
if( ImGui::IsMouseClicked( 0 ) )
|
|
||||||
{
|
{
|
||||||
showFull = !showFull;
|
draw->AddTriangle( wpos + ImVec2( to/2, offset + to/2 ), wpos + ImVec2( to/2, offset + ty - to/2 ), wpos + ImVec2( to/2 + th, offset + ty * 0.5 ), 0xFF888888 );
|
||||||
}
|
}
|
||||||
|
const auto txt = m_worker.GetThreadString( v->id );
|
||||||
ImGui::BeginTooltip();
|
const auto txtsz = ImGui::CalcTextSize( txt );
|
||||||
ImGui::Text( "%s", m_worker.GetThreadString( v->id ) );
|
if( m_gpuThread == v->id )
|
||||||
if( !v->timeline.empty() )
|
|
||||||
{
|
{
|
||||||
ImGui::Separator();
|
draw->AddRectFilled( wpos + ImVec2( 0, offset ), wpos + ImVec2( ty + txtsz.x + 4, offset + ty ), 0x448888DD );
|
||||||
ImGui::Text( "Appeared at %s", TimeToString( v->timeline.front()->start - m_worker.GetFrameBegin( 0 ) ) );
|
draw->AddRect( wpos + ImVec2( 0, offset ), wpos + ImVec2( ty + txtsz.x + 4, offset + ty ), 0x888888DD );
|
||||||
ImGui::Text( "Zone count: %s", RealToString( v->count, true ) );
|
|
||||||
ImGui::Text( "Top-level zones: %s", RealToString( v->timeline.size(), true ) );
|
|
||||||
}
|
}
|
||||||
ImGui::EndTooltip();
|
if( m_gpuInfoWindow && m_gpuInfoWindowThread == v->id )
|
||||||
|
{
|
||||||
|
draw->AddRectFilled( wpos + ImVec2( 0, offset ), wpos + ImVec2( ty + txtsz.x + 4, offset + ty ), 0x4488DD88 );
|
||||||
|
draw->AddRect( wpos + ImVec2( 0, offset ), wpos + ImVec2( ty + txtsz.x + 4, offset + ty ), 0x8888DD88 );
|
||||||
|
}
|
||||||
|
draw->AddText( wpos + ImVec2( ty, offset ), showFull ? 0xFFFFFFFF : 0xFF888888, txt );
|
||||||
|
|
||||||
|
if( hover && ImGui::IsMouseHoveringRect( wpos + ImVec2( 0, offset ), wpos + ImVec2( ty + txtsz.x, offset + ty ) ) )
|
||||||
|
{
|
||||||
|
if( ImGui::IsMouseClicked( 0 ) )
|
||||||
|
{
|
||||||
|
showFull = !showFull;
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui::BeginTooltip();
|
||||||
|
ImGui::Text( "%s", m_worker.GetThreadString( v->id ) );
|
||||||
|
if( !v->timeline.empty() )
|
||||||
|
{
|
||||||
|
ImGui::Separator();
|
||||||
|
ImGui::Text( "Appeared at %s", TimeToString( v->timeline.front()->start - m_worker.GetFrameBegin( 0 ) ) );
|
||||||
|
ImGui::Text( "Zone count: %s", RealToString( v->count, true ) );
|
||||||
|
ImGui::Text( "Top-level zones: %s", RealToString( v->timeline.size(), true ) );
|
||||||
|
}
|
||||||
|
ImGui::EndTooltip();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
offset += ostep;
|
offset += ostep;
|
||||||
|
Loading…
Reference in New Issue
Block a user