Save GPU context calibration state.

This commit is contained in:
Bartosz Taudul 2020-07-07 21:19:33 +02:00
parent a3c51f0e7e
commit e48b5611c5
2 changed files with 18 additions and 10 deletions

View File

@ -7,7 +7,7 @@ namespace Version
{ {
enum { Major = 0 }; enum { Major = 0 };
enum { Minor = 7 }; enum { Minor = 7 };
enum { Patch = 0 }; enum { Patch = 1 };
} }
} }

View File

@ -923,7 +923,14 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
for( uint64_t i=0; i<sz; i++ ) for( uint64_t i=0; i<sz; i++ )
{ {
auto ctx = m_slab.AllocInit<GpuCtxData>(); auto ctx = m_slab.AllocInit<GpuCtxData>();
// TODO remove if( fileVer >= FileVersion( 0, 7, 1 ) )
{
uint8_t calibration;
f.Read5( ctx->thread, calibration, ctx->count, ctx->period, ctx->type );
ctx->hasCalibration = calibration;
}
else
{
uint8_t accuracy; uint8_t accuracy;
if( fileVer >= FileVersion( 0, 6, 14 ) ) if( fileVer >= FileVersion( 0, 6, 14 ) )
{ {
@ -934,6 +941,8 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
f.Read4( ctx->thread, accuracy, ctx->count, ctx->period ); f.Read4( ctx->thread, accuracy, ctx->count, ctx->period );
ctx->type = ctx->thread == 0 ? GpuContextType::Vulkan : GpuContextType::OpenGl; ctx->type = ctx->thread == 0 ? GpuContextType::Vulkan : GpuContextType::OpenGl;
} }
ctx->hasCalibration = false;
}
ctx->hasPeriod = ctx->period != 1.f; ctx->hasPeriod = ctx->period != 1.f;
m_data.gpuCnt += ctx->count; m_data.gpuCnt += ctx->count;
uint64_t tdsz; uint64_t tdsz;
@ -6619,9 +6628,8 @@ void Worker::Write( FileWrite& f )
for( auto& ctx : m_data.gpuData ) for( auto& ctx : m_data.gpuData )
{ {
f.Write( &ctx->thread, sizeof( ctx->thread ) ); f.Write( &ctx->thread, sizeof( ctx->thread ) );
// TODO remove uint8_t calibration = ctx->hasCalibration;
uint8_t zero = 0; f.Write( &calibration, sizeof( calibration ) );
f.Write( &zero, sizeof( zero ) );
f.Write( &ctx->count, sizeof( ctx->count ) ); f.Write( &ctx->count, sizeof( ctx->count ) );
f.Write( &ctx->period, sizeof( ctx->period ) ); f.Write( &ctx->period, sizeof( ctx->period ) );
f.Write( &ctx->type, sizeof( ctx->type ) ); f.Write( &ctx->type, sizeof( ctx->type ) );