Fix broken behavior on duplicate names in zone info window.

This commit is contained in:
Bartosz Taudul 2018-03-28 01:57:53 +02:00
parent d6bf19a762
commit 9d798789a9

View File

@ -2466,14 +2466,17 @@ void View::DrawZoneInfoWindow()
ImGui::TextDisabled( "(%s)", RealToString( zoneTrace.size(), true ) ); ImGui::TextDisabled( "(%s)", RealToString( zoneTrace.size(), true ) );
if( expand ) if( expand )
{ {
int idx = 0;
for( auto& v : zoneTrace ) for( auto& v : zoneTrace )
{ {
const auto& srcloc = m_worker.GetSourceLocation( v->srcloc ); const auto& srcloc = m_worker.GetSourceLocation( v->srcloc );
const auto txt = srcloc.name.active ? m_worker.GetString( srcloc.name ) : m_worker.GetString( srcloc.function ); const auto txt = srcloc.name.active ? m_worker.GetString( srcloc.name ) : m_worker.GetString( srcloc.function );
ImGui::PushID( idx++ );
auto sel = ImGui::Selectable( txt, false ); auto sel = ImGui::Selectable( txt, false );
auto hover = ImGui::IsItemHovered(); auto hover = ImGui::IsItemHovered();
ImGui::SameLine(); ImGui::SameLine();
ImGui::TextDisabled( "%s:%i", m_worker.GetString( srcloc.file ), srcloc.line ); ImGui::TextDisabled( "%s:%i", m_worker.GetString( srcloc.file ), srcloc.line );
ImGui::PopID();
if( sel ) if( sel )
{ {
m_zoneInfoWindow = v; m_zoneInfoWindow = v;
@ -2527,6 +2530,7 @@ void View::DrawZoneInfoWindow()
const auto& csl = m_worker.GetSourceLocation( cev.srcloc ); const auto& csl = m_worker.GetSourceLocation( cev.srcloc );
const auto txt = csl.name.active ? m_worker.GetString( csl.name ) : m_worker.GetString( csl.function ); const auto txt = csl.name.active ? m_worker.GetString( csl.name ) : m_worker.GetString( csl.function );
bool b = false; bool b = false;
ImGui::PushID( (int)i );
if( ImGui::Selectable( txt, &b, ImGuiSelectableFlags_SpanAllColumns ) ) if( ImGui::Selectable( txt, &b, ImGuiSelectableFlags_SpanAllColumns ) )
{ {
m_zoneInfoWindow = &cev; m_zoneInfoWindow = &cev;
@ -2540,6 +2544,7 @@ void View::DrawZoneInfoWindow()
} }
ZoneTooltip( cev ); ZoneTooltip( cev );
} }
ImGui::PopID();
ImGui::NextColumn(); ImGui::NextColumn();
const auto part = double( ctt[cti[i]] ) / ztime; const auto part = double( ctt[cti[i]] ) / ztime;
char buf[128]; char buf[128];
@ -2620,14 +2625,17 @@ void View::DrawGpuInfoWindow()
ImGui::TextDisabled( "(%s)", RealToString( zoneTrace.size(), true ) ); ImGui::TextDisabled( "(%s)", RealToString( zoneTrace.size(), true ) );
if( expand ) if( expand )
{ {
int idx = 0;
for( auto& v : zoneTrace ) for( auto& v : zoneTrace )
{ {
const auto& srcloc = m_worker.GetSourceLocation( v->srcloc ); const auto& srcloc = m_worker.GetSourceLocation( v->srcloc );
const auto txt = srcloc.name.active ? m_worker.GetString( srcloc.name ) : m_worker.GetString( srcloc.function ); const auto txt = srcloc.name.active ? m_worker.GetString( srcloc.name ) : m_worker.GetString( srcloc.function );
ImGui::PushID( idx++ );
auto sel = ImGui::Selectable( txt, false ); auto sel = ImGui::Selectable( txt, false );
auto hover = ImGui::IsItemHovered(); auto hover = ImGui::IsItemHovered();
ImGui::SameLine(); ImGui::SameLine();
ImGui::TextDisabled( "%s:%i", m_worker.GetString( srcloc.file ), srcloc.line ); ImGui::TextDisabled( "%s:%i", m_worker.GetString( srcloc.file ), srcloc.line );
ImGui::PopID();
if( sel ) if( sel )
{ {
m_gpuInfoWindow = v; m_gpuInfoWindow = v;
@ -2680,6 +2688,7 @@ void View::DrawGpuInfoWindow()
auto& cev = *ev.child[cti[i]]; auto& cev = *ev.child[cti[i]];
const auto& csl = m_worker.GetSourceLocation( cev.srcloc ); const auto& csl = m_worker.GetSourceLocation( cev.srcloc );
bool b = false; bool b = false;
ImGui::PushID( (int)i );
if( ImGui::Selectable( m_worker.GetString( csl.name ), &b, ImGuiSelectableFlags_SpanAllColumns ) ) if( ImGui::Selectable( m_worker.GetString( csl.name ), &b, ImGuiSelectableFlags_SpanAllColumns ) )
{ {
m_gpuInfoWindow = &cev; m_gpuInfoWindow = &cev;
@ -2693,6 +2702,7 @@ void View::DrawGpuInfoWindow()
} }
ZoneTooltip( cev ); ZoneTooltip( cev );
} }
ImGui::PopID();
ImGui::NextColumn(); ImGui::NextColumn();
const auto part = double( ctt[cti[i]] ) / ztime; const auto part = double( ctt[cti[i]] ) / ztime;
char buf[128]; char buf[128];