Use TimelineContext for drawing GPU zones.

This commit is contained in:
Bartosz Taudul 2023-03-19 00:28:14 +01:00
parent 5743bff0af
commit ee5d6f1adb
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3
3 changed files with 14 additions and 7 deletions

View File

@ -191,7 +191,7 @@ int64_t TimelineItemGpu::RangeEnd() const
bool TimelineItemGpu::DrawContents( const TimelineContext& ctx, int& offset )
{
return m_view.DrawGpu( *m_gpu, ctx.pxns, offset, ctx.wpos, ctx.hover, ctx.yMin, ctx.yMax );
return m_view.DrawGpu( ctx, *m_gpu, offset );
}
}

View File

@ -124,7 +124,7 @@ public:
bool DrawThread( const ThreadData& thread, double pxns, int& offset, const ImVec2& wpos, bool hover, float yMin, float yMax, bool ghostMode );
void DrawThreadMessages( const ThreadData& thread, double pxns, int offset, const ImVec2& wpos, bool hover );
void DrawThreadOverlays( const ThreadData& thread, const ImVec2& ul, const ImVec2& dr );
bool DrawGpu( const GpuCtxData& gpu, double pxns, int& offset, const ImVec2& wpos, bool hover, float yMin, float yMax );
bool DrawGpu( const TimelineContext& ctx, const GpuCtxData& gpu, int& offset );
bool DrawCpuData( const TimelineContext& ctx, int& offset );
bool m_showRanges = false;

View File

@ -2,6 +2,7 @@
#include "TracyImGui.hpp"
#include "TracyMouse.hpp"
#include "TracyPrint.hpp"
#include "TracyTimelineContext.hpp"
#include "TracyView.hpp"
namespace tracy
@ -9,14 +10,20 @@ namespace tracy
constexpr float MinVisSize = 3;
bool View::DrawGpu( const GpuCtxData& gpu, double pxns, int& offset, const ImVec2& wpos, bool hover, float yMin, float yMax )
bool View::DrawGpu( const TimelineContext& ctx, const GpuCtxData& gpu, int& offset )
{
const auto w = ImGui::GetContentRegionAvail().x - 1;
const auto ty = ImGui::GetTextLineHeight();
const auto w = ctx.w;
const auto ty = ctx.ty;
const auto ostep = ty + 1;
const auto nspx = 1.0 / pxns;
auto draw = ImGui::GetWindowDrawList();
const auto pxns = ctx.pxns;
const auto nspx = ctx.nspx;
const auto& wpos = ctx.wpos;
const auto dpos = wpos + ImVec2( 0.5f, 0.5f );
const auto hover = ctx.hover;
const auto yMin = ctx.yMin;
const auto yMax = ctx.yMax;
auto draw = ImGui::GetWindowDrawList();
ImGui::PushFont( m_smallFont );
const auto sty = ImGui::GetTextLineHeight();