diff --git a/profiler/src/profiler/TracyView.cpp b/profiler/src/profiler/TracyView.cpp index cf18e7ee..ab0851ed 100644 --- a/profiler/src/profiler/TracyView.cpp +++ b/profiler/src/profiler/TracyView.cpp @@ -758,7 +758,7 @@ bool View::DrawImpl() } const auto& io = ImGui::GetIO(); - m_wasActive = false; + m_wasActive.store( false, std::memory_order_release ); assert( m_shortcut == ShortcutAction::None ); if( io.KeyCtrl ) @@ -1254,14 +1254,18 @@ bool View::DrawImpl() } } - m_wasActive |= m_callstackBuzzAnim.Update( io.DeltaTime ); - m_wasActive |= m_sampleParentBuzzAnim.Update( io.DeltaTime ); - m_wasActive |= m_callstackTreeBuzzAnim.Update( io.DeltaTime ); - m_wasActive |= m_zoneinfoBuzzAnim.Update( io.DeltaTime ); - m_wasActive |= m_findZoneBuzzAnim.Update( io.DeltaTime ); - m_wasActive |= m_optionsLockBuzzAnim.Update( io.DeltaTime ); - m_wasActive |= m_lockInfoAnim.Update( io.DeltaTime ); - m_wasActive |= m_statBuzzAnim.Update( io.DeltaTime ); + bool active = m_wasActive.load( std::memory_order_acquire ); + + active |= m_callstackBuzzAnim.Update( io.DeltaTime ); + active |= m_sampleParentBuzzAnim.Update( io.DeltaTime ); + active |= m_callstackTreeBuzzAnim.Update( io.DeltaTime ); + active |= m_zoneinfoBuzzAnim.Update( io.DeltaTime ); + active |= m_findZoneBuzzAnim.Update( io.DeltaTime ); + active |= m_optionsLockBuzzAnim.Update( io.DeltaTime ); + active |= m_lockInfoAnim.Update( io.DeltaTime ); + active |= m_statBuzzAnim.Update( io.DeltaTime ); + + m_wasActive.store( active, std::memory_order_release ); if( m_firstFrame ) { @@ -1494,7 +1498,7 @@ void View::SelectThread( uint64_t thread ) bool View::WasActive() const { - return m_wasActive || + return m_wasActive.load( std::memory_order_acquire ) || m_zoomAnim.active || m_notificationTime > 0 || !m_playback.pause || diff --git a/profiler/src/profiler/TracyView.hpp b/profiler/src/profiler/TracyView.hpp index ad1385ba..f6de8d20 100644 --- a/profiler/src/profiler/TracyView.hpp +++ b/profiler/src/profiler/TracyView.hpp @@ -658,7 +658,7 @@ private: std::vector> m_annotations; UserData m_userData; - bool m_wasActive = false; + alignas(64) std::atomic m_wasActive { false }; bool m_reconnectRequested = false; bool m_firstFrame = true; std::chrono::time_point m_firstFrameTime; diff --git a/profiler/src/profiler/TracyView_FindZone.cpp b/profiler/src/profiler/TracyView_FindZone.cpp index 4261da2c..903dac51 100644 --- a/profiler/src/profiler/TracyView_FindZone.cpp +++ b/profiler/src/profiler/TracyView_FindZone.cpp @@ -1410,7 +1410,7 @@ void View::DrawFindZone() const auto c = uint32_t( ( sin( s_time * 10 ) * 0.25 + 0.75 ) * 255 ); const auto color = 0xFF000000 | ( c << 16 ) | ( c << 8 ) | c; DrawLine( draw, ImVec2( dpos.x + zonePos, dpos.y ), ImVec2( dpos.x + zonePos, dpos.y+Height-2 ), color ); - m_wasActive = true; + m_wasActive.store( true, std::memory_order_release ); } } } diff --git a/profiler/src/profiler/TracyView_Locks.cpp b/profiler/src/profiler/TracyView_Locks.cpp index 670382fe..cb58c214 100644 --- a/profiler/src/profiler/TracyView_Locks.cpp +++ b/profiler/src/profiler/TracyView_Locks.cpp @@ -454,7 +454,7 @@ int View::DrawLocks( const TimelineContext& ctx, const std::vector( std::chrono::system_clock::now().time_since_epoch() ).count() * 0.01 ) * 0.5 + 0.5 ) * 255 ); draw->AddRect( wpos + ImVec2( std::max( px0, -10.0 ), offset ), wpos + ImVec2( std::min( px1, double( w + 10 ) ), offset + ty ), 0x00FFFFFF | ( t << 24 ), 0.f, -1, 2.f ); - m_wasActive = true; + m_wasActive.store( true, std::memory_order_release ); } else if( v.condensed == 0 ) { diff --git a/profiler/src/profiler/TracyView_TraceInfo.cpp b/profiler/src/profiler/TracyView_TraceInfo.cpp index d43f4b14..d3309519 100644 --- a/profiler/src/profiler/TracyView_TraceInfo.cpp +++ b/profiler/src/profiler/TracyView_TraceInfo.cpp @@ -676,7 +676,7 @@ void View::DrawInfo() const auto c = uint32_t( ( sin( s_time * 10 ) * 0.25 + 0.75 ) * 255 ); const auto color = 0xFF000000 | ( c << 16 ) | ( c << 8 ) | c; DrawLine( draw, ImVec2( dpos.x + framePos, dpos.y ), ImVec2( dpos.x + framePos, dpos.y+Height-2 ), color ); - m_wasActive = true; + m_wasActive.store( true, std::memory_order_release ); } } } diff --git a/profiler/src/profiler/TracyView_ZoneTimeline.cpp b/profiler/src/profiler/TracyView_ZoneTimeline.cpp index 7cdac674..002f7412 100644 --- a/profiler/src/profiler/TracyView_ZoneTimeline.cpp +++ b/profiler/src/profiler/TracyView_ZoneTimeline.cpp @@ -130,7 +130,7 @@ void View::DrawThreadMessagesList( const TimelineContext& ctx, const std::vector if( !isMsgHovered ) { animOff = -fabs( sin( s_time * 8 ) ) * th; - m_wasActive = true; + m_wasActive.store( true, std::memory_order_release ); } }