Fix startup failure on older CPUs that don't support invariant TSC

#580
This commit is contained in:
Wojtek Figat
2021-08-08 16:38:28 +02:00
parent 84cca1ae98
commit 50bccd52e7
2 changed files with 5 additions and 0 deletions

View File

@@ -228,6 +228,7 @@ static int64_t SetupHwTimer()
uint32_t regs[4];
CpuId( regs, 1 );
if( !( regs[3] & ( 1 << 4 ) ) ) InitFailure( "CPU doesn't support RDTSC instruction." );
#if !defined TRACY_NO_INVARIANT_CHECK
CpuId( regs, 0x80000007 );
if( !( regs[3] & ( 1 << 8 ) ) )
{
@@ -241,6 +242,7 @@ static int64_t SetupHwTimer()
#endif
}
}
#endif
#endif
return Profiler::GetTime();

View File

@@ -34,7 +34,10 @@ public class tracy : ThirdPartyModule
options.PublicDefinitions.Add("TRACY_ENABLE");
if (options.Platform.Target == TargetPlatform.Windows)
{
options.PrivateDefinitions.Add("TRACY_DBGHELP_LOCK=DbgHelp");
options.PrivateDefinitions.Add("TRACY_NO_INVARIANT_CHECK");
}
}
/// <inheritdoc />