Replace floating point condition with a bool.

This commit is contained in:
Bartosz Taudul 2020-06-16 01:42:52 +02:00
parent dd05c8f524
commit 7a6141389c
2 changed files with 5 additions and 2 deletions

View File

@ -564,9 +564,10 @@ struct GpuCtxData
uint64_t count;
uint8_t accuracyBits;
float period;
GpuContextType type;
bool hasPeriod;
unordered_flat_map<uint64_t, GpuCtxThreadData> threadData;
short_ptr<GpuEvent> query[64*1024];
GpuContextType type;
};
enum { GpuCtxDataSize = sizeof( GpuCtxData ) };

View File

@ -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<int64_t>( 0, tref );
int64_t gpuTime;
if( ctx->period == 1.f )
if( !ctx->hasPeriod )
{
gpuTime = t;
}