1
0
mirror of https://github.com/wolfpld/tracy.git synced 2025-03-20 07:40:02 +08:00

Merge branch 'master' into master

This commit is contained in:
Andrew Depke
2020-06-08 23:50:20 -06:00
committed by GitHub
15 changed files with 595 additions and 17 deletions
+16 -5
View File
@@ -436,6 +436,7 @@ void SourceView::ParseSource( const char* fileName, const Worker& worker, const
{
if( m_file != fileName )
{
m_srcWidth = 0;
m_file = fileName;
m_fileStringIdx = worker.FindStringIdx( fileName );
m_lines.clear();
@@ -510,6 +511,7 @@ bool SourceView::Disassemble( uint64_t symAddr, const Worker& worker )
m_maxJumpLevel = 0;
m_asmSelected = -1;
m_asmCountBase = -1;
m_asmWidth = 0;
if( symAddr == 0 ) return false;
m_cpuArch = worker.GetCpuArch();
if( m_cpuArch == CpuArchUnknown ) return false;
@@ -889,6 +891,7 @@ void SourceView::Render( const Worker& worker, View& view )
void SourceView::RenderSimpleSourceView()
{
ImGui::SetNextWindowContentSize( ImVec2( m_srcWidth, 0 ) );
ImGui::BeginChild( "##sourceView", ImVec2( 0, 0 ), true, ImGuiWindowFlags_HorizontalScrollbar );
if( m_font ) ImGui::PushFont( m_font );
@@ -915,6 +918,8 @@ void SourceView::RenderSimpleSourceView()
}
RenderLine( line, lineNum++, 0, 0, 0, nullptr );
}
const auto win = ImGui::GetCurrentWindowRead();
m_srcWidth = win->DC.CursorMaxPos.x - win->DC.CursorStartPos.x;
}
else
{
@@ -1376,11 +1381,12 @@ void SourceView::RenderSymbolSourceView( uint32_t iptotal, unordered_flat_map<ui
}
const float bottom = m_srcSampleSelect.empty() ? 0 : ImGui::GetFrameHeight();
ImGui::SetNextWindowContentSize( ImVec2( m_srcWidth, 0 ) );
ImGui::BeginChild( "##sourceView", ImVec2( 0, -bottom ), true, ImGuiWindowFlags_NoMove | ImGuiWindowFlags_HorizontalScrollbar );
if( m_font ) ImGui::PushFont( m_font );
auto draw = ImGui::GetWindowDrawList();
const auto wpos = ImGui::GetWindowPos();
const auto wpos = ImGui::GetWindowPos() - ImVec2( ImGui::GetCurrentWindowRead()->Scroll.x, 0 );
const auto wh = ImGui::GetWindowHeight();
const auto ty = ImGui::GetFontSize();
const auto ts = ImGui::CalcTextSize( " " ).x;
@@ -1410,6 +1416,8 @@ void SourceView::RenderSymbolSourceView( uint32_t iptotal, unordered_flat_map<ui
}
RenderLine( line, lineNum++, 0, iptotal, ipmax, &worker );
}
const auto win = ImGui::GetCurrentWindowRead();
m_srcWidth = win->DC.CursorMaxPos.x - win->DC.CursorStartPos.x;
}
else
{
@@ -1435,7 +1443,7 @@ void SourceView::RenderSymbolSourceView( uint32_t iptotal, unordered_flat_map<ui
}
}
auto win = ImGui::GetCurrentWindow();
const auto win = ImGui::GetCurrentWindowRead();
if( win->ScrollbarY )
{
auto draw = ImGui::GetWindowDrawList();
@@ -1654,6 +1662,7 @@ uint64_t SourceView::RenderSymbolAsmView( uint32_t iptotal, unordered_flat_map<u
#endif
const float bottom = m_asmSampleSelect.empty() ? 0 : ImGui::GetFrameHeight();
ImGui::SetNextWindowContentSize( ImVec2( m_asmWidth, 0 ) );
ImGui::BeginChild( "##asmView", ImVec2( 0, -bottom ), true, ImGuiWindowFlags_NoMove | ImGuiWindowFlags_HorizontalScrollbar );
if( m_font ) ImGui::PushFont( m_font );
@@ -1680,6 +1689,8 @@ uint64_t SourceView::RenderSymbolAsmView( uint32_t iptotal, unordered_flat_map<u
}
RenderAsmLine( line, 0, iptotal, ipmax, worker, jumpOut, maxAddrLen, view );
}
const auto win = ImGui::GetCurrentWindowRead();
m_asmWidth = win->DC.CursorMaxPos.x - win->DC.CursorStartPos.x;
}
else
{
@@ -1848,7 +1859,7 @@ uint64_t SourceView::RenderSymbolAsmView( uint32_t iptotal, unordered_flat_map<u
#endif
}
auto win = ImGui::GetCurrentWindow();
const auto win = ImGui::GetCurrentWindowRead();
if( win->ScrollbarY )
{
auto draw = ImGui::GetWindowDrawList();
@@ -2080,7 +2091,7 @@ void SourceView::RenderLine( const Line& line, int lineNum, uint32_t ipcnt, uint
{
const auto ty = ImGui::GetFontSize();
auto draw = ImGui::GetWindowDrawList();
const auto w = ImGui::GetWindowWidth();
const auto w = std::max( m_srcWidth, ImGui::GetWindowWidth() );
const auto wpos = ImGui::GetCursorScreenPos();
if( m_fileStringIdx == m_hoveredSource && lineNum == m_hoveredLine )
{
@@ -2257,7 +2268,7 @@ void SourceView::RenderAsmLine( AsmLine& line, uint32_t ipcnt, uint32_t iptotal,
{
const auto ty = ImGui::GetFontSize();
auto draw = ImGui::GetWindowDrawList();
const auto w = ImGui::GetWindowWidth();
const auto w = std::max( m_asmWidth, ImGui::GetWindowWidth() );
const auto wpos = ImGui::GetCursorScreenPos();
if( m_selectedAddressesHover.find( line.addr ) != m_selectedAddressesHover.end() )
{
+3
View File
@@ -239,6 +239,9 @@ private:
unordered_flat_set<uint32_t> m_srcSampleSelect;
uint32_t m_asmGroupSelect = -1;
uint32_t m_srcGroupSelect = -1;
float m_srcWidth;
float m_asmWidth;
};
}
+1 -1
View File
@@ -7,7 +7,7 @@ namespace Version
{
enum { Major = 0 };
enum { Minor = 6 };
enum { Patch = 14 };
enum { Patch = 15 };
}
}
+5 -3
View File
@@ -76,6 +76,7 @@ constexpr const char* GpuContextNames[] = {
"Invalid",
"OpenGL",
"Vulkan",
"OpenCL",
"Direct3D 12"
};
@@ -1293,7 +1294,7 @@ void View::DrawFrames()
enum { MaxFrameTime = 50 * 1000 * 1000 }; // 50ms
ImGuiWindow* window = ImGui::GetCurrentWindow();
ImGuiWindow* window = ImGui::GetCurrentWindowRead();
if( window->SkipItems ) return;
auto& io = ImGui::GetIO();
@@ -2300,7 +2301,7 @@ void View::DrawZones()
if( m_vd.zvStart == m_vd.zvEnd ) return;
assert( m_vd.zvStart < m_vd.zvEnd );
if( ImGui::GetCurrentWindow()->SkipItems ) return;
if( ImGui::GetCurrentWindowRead()->SkipItems ) return;
m_gpuThread = 0;
m_gpuStart = 0;
@@ -2473,7 +2474,8 @@ void View::DrawZones()
draw->AddTriangle( wpos + ImVec2( to/2, oldOffset + to/2 ), wpos + ImVec2( to/2, oldOffset + ty - to/2 ), wpos + ImVec2( to/2 + th, oldOffset + ty * 0.5 ), 0xFF886666, 2.0f );
}
const bool isMultithreaded = (v->type == GpuContextType::Vulkan || v->type == GpuContextType::Direct3D12);
const bool isMultithreaded = (v->type == GpuContextType::Vulkan) || (v->type == GpuContextType::OpenCL) || (v->type == GpuContextType::Direct3D12);
char buf[64];
sprintf( buf, "%s context %zu", GpuContextNames[(int)v->type], i );
DrawTextContrast( draw, wpos + ImVec2( ty, oldOffset ), showFull ? 0xFFFFAAAA : 0xFF886666, buf );