From 7a6141389cbf0099cb1c19a340396f1f1121f600 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Tue, 16 Jun 2020 01:42:52 +0200 Subject: [PATCH] Replace floating point condition with a bool. --- server/TracyEvent.hpp | 3 ++- server/TracyWorker.cpp | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/server/TracyEvent.hpp b/server/TracyEvent.hpp index 74ce7f75..c1401fbd 100644 --- a/server/TracyEvent.hpp +++ b/server/TracyEvent.hpp @@ -564,9 +564,10 @@ struct GpuCtxData uint64_t count; uint8_t accuracyBits; float period; + GpuContextType type; + bool hasPeriod; unordered_flat_map threadData; short_ptr query[64*1024]; - GpuContextType type; }; enum { GpuCtxDataSize = sizeof( GpuCtxData ) }; diff --git a/server/TracyWorker.cpp b/server/TracyWorker.cpp index e2d39947..f0833710 100644 --- a/server/TracyWorker.cpp +++ b/server/TracyWorker.cpp @@ -892,6 +892,7 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks ) f.Read4( ctx->thread, ctx->accuracyBits, ctx->count, ctx->period ); ctx->type = ctx->thread == 0 ? GpuContextType::Vulkan : GpuContextType::OpenGl; } + ctx->hasPeriod = ctx->period != 1.f; m_data.gpuCnt += ctx->count; uint64_t tdsz; f.Read( tdsz ); @@ -4849,6 +4850,7 @@ void Worker::ProcessGpuNewContext( const QueueGpuNewContext& ev ) gpu->period = ev.period; gpu->count = 0; gpu->type = ev.type; + gpu->hasPeriod = ev.period != 1.f; m_data.gpuData.push_back( gpu ); m_gpuCtxMap[ev.context] = gpu; } @@ -4980,7 +4982,7 @@ void Worker::ProcessGpuTime( const QueueGpuTime& ev ) const int64_t t = std::max( 0, tref ); int64_t gpuTime; - if( ctx->period == 1.f ) + if( !ctx->hasPeriod ) { gpuTime = t; }