From 474b3dbdfb020d0bae071aa6fa405a7f0a0ece04 Mon Sep 17 00:00:00 2001 From: Marcos Slomp Date: Wed, 8 Apr 2026 13:10:11 -0700 Subject: [PATCH] comments --- public/tracy/TracyD3D12.hpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/public/tracy/TracyD3D12.hpp b/public/tracy/TracyD3D12.hpp index f3df4cc7..969362dd 100644 --- a/public/tracy/TracyD3D12.hpp +++ b/public/tracy/TracyD3D12.hpp @@ -322,9 +322,6 @@ namespace tracy if (Distance(earliestTicket, endTicket) <= 0) return; - // TODO: check device lost - // check the queries, but do not emit them just yet - UINT64* timestampBuffer = MapTimestampBuffer(); // Attempt to collect as many resolved queries as possible @@ -356,9 +353,12 @@ namespace tracy UnmapTimestampBuffer(timestampBuffer); - // TODO: check device lost, again - // only emit resolved queries if device has not been lost - // (reading from readback heaps can be wonky in such cases) + // TODO: check for device status (device lost). + // Technically speaking, values read from the timestamp buffer (readback heap) + // should only be trusted while the device is "fine". Ideally, queries should + // be "peeked" first, and those deemed "resolved" should only be "emitted" if + // the device is fine, or dropped otherwise. All that said, the collect code, + // as is, should not cause catastrophic issues. RecalibrateClocks(); } @@ -529,6 +529,12 @@ namespace tracy #endif } + bool DeviceLost() + { + HRESULT status = m_device->GetDeviceRemovedReason(); + return (status != S_OK); + } + tracy_force_inline uint8_t GetId() const { return m_contextId;