From 7e70154e4ed5d73b20c975bd573b3ccd76b548fb Mon Sep 17 00:00:00 2001 From: Marcos Slomp Date: Sat, 4 Apr 2026 14:02:25 -0700 Subject: [PATCH] cleanup --- public/tracy/TracyD3D12.hpp | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/public/tracy/TracyD3D12.hpp b/public/tracy/TracyD3D12.hpp index a3afaac8..ca0fa27a 100644 --- a/public/tracy/TracyD3D12.hpp +++ b/public/tracy/TracyD3D12.hpp @@ -89,10 +89,7 @@ namespace tracy uint32_t m_queryLimit = 0; - using AgeTime = std::chrono::high_resolution_clock::time_point; - std::vector m_queryRequestTime; std::vector m_shadowBuffer; - UINT64 m_latestKnownGpuTimestamp = 0; UINT64 m_prevCalibrationTicksCPU = 0; @@ -223,9 +220,7 @@ namespace tracy TracyD3D12Panic("Failed to get queue clock calibration.", return); } - m_latestKnownGpuTimestamp = gpuTimestamp; - m_queryRequestTime.resize(m_queryLimit, AgeTime::clock::now()); - m_shadowBuffer.resize(m_queryLimit, m_latestKnownGpuTimestamp); + m_shadowBuffer.resize(m_queryLimit, gpuTimestamp); // Save the device cpu timestamp, not the profiler's timestamp. m_prevCalibrationTicksCPU = cpuTimestamp; @@ -333,7 +328,7 @@ namespace tracy UINT64* timestampBuffer = MapTimestampBuffer(); - while (Distance(earliestTicket, latestTicket) > RingSize()) + while (Distance(earliestTicket, latestTicket) > RingCapacity()) { uint64_t ticket = earliestTicket; DropTimestamp(earliestTicket, timestampBuffer); @@ -344,6 +339,7 @@ namespace tracy for (uint64_t ticket = earliestTicket; ticket != latestTicket; ticket += 2) { if (!ResolveTimestamp(ticket, timestampBuffer)) + // TODO: preemptive timeout policy break; m_previousCheckpoint.store(ticket + 2); } @@ -367,8 +363,6 @@ namespace tracy EmitGpuTime(gpuZoneEndTimestamp, queryId+1); m_shadowBuffer[queryId+0] = gpuZoneEndTimestamp; m_shadowBuffer[queryId+1] = gpuZoneEndTimestamp; - if (Distance(m_latestKnownGpuTimestamp, gpuZoneEndTimestamp) > 0) - m_latestKnownGpuTimestamp = gpuZoneEndTimestamp; return true; } void DropTimestamp(uint64_t ticket, UINT64* timestampBuffer) @@ -408,14 +402,14 @@ namespace tracy ); } - tracy_force_inline uint32_t RingSize() const + tracy_force_inline uint32_t RingCapacity() const { return m_queryLimit; } tracy_force_inline uint32_t RingIndex(uint64_t logicalSlot) const { - return static_cast(logicalSlot % RingSize()); + return static_cast(logicalSlot % RingCapacity()); } tracy_force_inline static int64_t Distance(uint64_t begin, uint64_t end) @@ -437,7 +431,7 @@ namespace tracy // query pair immediately upon m_queryCounter being incremented, the "late" // timestamp value may be collected as if it belonged to the the new query. const uint64_t ticket = m_queryCounter.fetch_add(2, std::memory_order_relaxed); - while (Distance(m_previousCheckpoint, ticket) >= RingSize()) + while (Distance(m_previousCheckpoint, ticket) >= RingCapacity()) { ZoneScopedC(Color::Red4); ZoneValue(int64_t(m_contextId));