From dc9dfb2e65922d1815adf4db7a8e326f954c9cf8 Mon Sep 17 00:00:00 2001 From: Alan Tse Date: Sun, 19 Jul 2026 19:40:50 -0700 Subject: [PATCH] fix(d3d11): guard collector against zero frequency D3D11_QUERY_DATA_TIMESTAMP_DISJOINT can report Frequency == 0 even when Disjoint == FALSE. Neither the initial CPU/GPU calibration loop nor the per-frame Collect() path guarded against this, so `timestamp * (1000000000 / disjoint.Frequency)` divides by zero and crashes the profiled application with EXCEPTION_INT_DIVIDE_BY_ZERO inside client instrumentation code. Treats a zero frequency the same as an existing guard already does for a disjoint result: skip/retry in calibration, and in Collect() advance the checkpoint and drop the batch via TracyD3D11Panic, matching the existing disjoint-timestamp handling immediately above it. --- public/tracy/TracyD3D11.hpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/public/tracy/TracyD3D11.hpp b/public/tracy/TracyD3D11.hpp index 8de75d6b..837f28ac 100644 --- a/public/tracy/TracyD3D11.hpp +++ b/public/tracy/TracyD3D11.hpp @@ -108,7 +108,7 @@ public: continue; } - if (disjoint.Disjoint) + if (disjoint.Disjoint || disjoint.Frequency == 0) continue; UINT64 timestamp = 0; @@ -217,6 +217,13 @@ public: return; } + if (disjoint.Frequency == 0) + { + m_previousCheckpoint = m_nextCheckpoint; + TracyD3D11Panic("zero GPU timestamp frequency; dropping."); + return; + } + auto begin = m_previousCheckpoint; auto end = m_nextCheckpoint; for (auto i = begin; i != end; ++i)