From 7ce8c772adae8802bfc529a7cb5eb7c2854c81cc Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Wed, 30 Oct 2019 22:37:07 +0100 Subject: [PATCH] Disallow negative GPU times. Shouldn't happen, but GPU timestamps are a shitshow, so better be safe than sorry. --- server/TracyWorker.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/server/TracyWorker.cpp b/server/TracyWorker.cpp index 6411104a..5e88e24a 100644 --- a/server/TracyWorker.cpp +++ b/server/TracyWorker.cpp @@ -4297,8 +4297,9 @@ void Worker::ProcessGpuTime( const QueueGpuTime& ev ) auto ctx = m_gpuCtxMap[ev.context]; assert( ctx ); - const int64_t t = m_refTimeGpu + ev.gpuTime; - m_refTimeGpu = t; + const int64_t tref = m_refTimeGpu + ev.gpuTime; + m_refTimeGpu = tref; + const int64_t t = std::max( 0, tref ); int64_t gpuTime; if( ctx->period == 1.f )