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

Show frame images in frame tooltips.

This commit is contained in:
Bartosz Taudul 2019-06-06 22:14:25 +02:00
parent 82d4fe7236
commit beea31edd0
2 changed files with 19 additions and 0 deletions

View File

@ -419,6 +419,8 @@ View::View( const char* addr, ImFont* fixedWidth, SetTitleCallback stcb )
assert( s_instance == nullptr ); assert( s_instance == nullptr );
s_instance = this; s_instance = this;
m_frameTexture = MakeTexture();
InitTextEditor(); InitTextEditor();
} }
@ -436,6 +438,8 @@ View::View( FileRead& f, ImFont* fixedWidth, SetTitleCallback stcb )
m_notificationTime = 4; m_notificationTime = 4;
m_notificationText = std::string( "Trace loaded in " ) + TimeToString( m_worker.GetLoadTime() ); m_notificationText = std::string( "Trace loaded in " ) + TimeToString( m_worker.GetLoadTime() );
m_frameTexture = MakeTexture();
InitTextEditor(); InitTextEditor();
SetViewToLastFrames(); SetViewToLastFrames();
} }
@ -447,6 +451,8 @@ View::~View()
if( m_compare.loadThread.joinable() ) m_compare.loadThread.join(); if( m_compare.loadThread.joinable() ) m_compare.loadThread.join();
if( m_saveThread.joinable() ) m_saveThread.join(); if( m_saveThread.joinable() ) m_saveThread.join();
FreeTexture( m_frameTexture );
assert( s_instance != nullptr ); assert( s_instance != nullptr );
s_instance = nullptr; s_instance = nullptr;
} }
@ -1640,6 +1646,15 @@ bool View::DrawZoneFrames( const FrameData& frames )
ImGui::TextUnformatted( GetFrameText( frames, i, ftime, m_worker.GetFrameOffset() ) ); ImGui::TextUnformatted( GetFrameText( frames, i, ftime, m_worker.GetFrameOffset() ) );
ImGui::Separator(); ImGui::Separator();
TextFocused( "Time from start of program:", TimeToString( m_worker.GetFrameBegin( frames, i ) - m_worker.GetTimeBegin() ) ); TextFocused( "Time from start of program:", TimeToString( m_worker.GetFrameBegin( frames, i ) - m_worker.GetTimeBegin() ) );
auto fi = m_worker.GetFrameImage( frames, i );
if( fi )
{
if( fi != m_frameTexturePtr )
{
UpdateTexture( m_frameTexture, fi->ptr, fi->w, fi->h );
}
ImGui::Image( m_frameTexture, ImVec2( fi->w, fi->h ) );
}
ImGui::EndTooltip(); ImGui::EndTooltip();
if( ImGui::IsMouseClicked( 2 ) ) if( ImGui::IsMouseClicked( 2 ) )

View File

@ -11,6 +11,7 @@
#include "TracyBuzzAnim.hpp" #include "TracyBuzzAnim.hpp"
#include "TracyDecayValue.hpp" #include "TracyDecayValue.hpp"
#include "TracyTexture.hpp"
#include "TracyVector.hpp" #include "TracyVector.hpp"
#include "TracyWorker.hpp" #include "TracyWorker.hpp"
#include "tracy_flat_hash_map.hpp" #include "tracy_flat_hash_map.hpp"
@ -326,6 +327,9 @@ private:
std::atomic<SaveThreadState> m_saveThreadState { SaveThreadState::Inert }; std::atomic<SaveThreadState> m_saveThreadState { SaveThreadState::Inert };
std::thread m_saveThread; std::thread m_saveThread;
void* m_frameTexture;
void* m_frameTexturePtr = nullptr;
struct FindZone { struct FindZone {
enum : uint64_t { Unselected = std::numeric_limits<uint64_t>::max() - 1 }; enum : uint64_t { Unselected = std::numeric_limits<uint64_t>::max() - 1 };
enum class GroupBy : int { Thread, UserText, Callstack }; enum class GroupBy : int { Thread, UserText, Callstack };