void FEngineLoop::Tick()
{
#if !UE_BUILD_SHIPPING && !UE_BUILD_TEST
FScopedSampleMallocChurn ChurnTracker;
#endif
// Ensure we aren't starting a frame while loading or playing a loading movie
ensure(GetMoviePlayer()->IsLoadingFinished() && !GetMoviePlayer()->IsMovieCurrentlyPlaying());
FExternalProfiler* ActiveProfiler = FActiveExternalProfilerBase::GetActiveProfiler();
if (ActiveProfiler)
{
ActiveProfiler->FrameSync();
}
SCOPED_NAMED_EVENT(FEngineLoopTick, FColor::Red);
// early in the Tick() to get the callbacks for cvar changes called
{
QUICK_SCOPE_CYCLE_COUNTER(STAT_FEngineLoop_Tick_CallAllConsoleVariableSinks);
IConsoleManager::Get().CallAllConsoleVariableSinks();
}
{
SCOPE_CYCLE_COUNTER( STAT_FrameTime );
ENQUEUE_UNIQUE_RENDER_COMMAND(
BeginFrame,
{
GRHICommandList.LatchBypass();
GFrameNumberRenderThread++;
RHICmdList.PushEvent(*FString::Printf(TEXT("Frame%d"),GFrameNumberRenderThread));
RHICmdList.BeginFrame();
});
{
QUICK_SCOPE_CYCLE_COUNTER(STAT_FEngineLoop_FlushThreadedLogs);
// Flush debug output which has been buffered by other threads.
GLog->FlushThreadedLogs();
}
// Exit if frame limit is reached in benchmark mode.
if( (FApp::IsBenchmarking() && MaxFrameCounter && (GFrameCounter > MaxFrameCounter))
// or time limit is reached if set.
|| (MaxTickTime && (TotalTickTime > MaxTickTime)) )
{
FPlatformMisc::RequestExit(0);
}
{
QUICK_SCOPE_CYCLE_COUNTER(STAT_FEngineLoop_
虚幻4 引擎主循环
最新推荐文章于 2023-10-28 20:04:12 发布
本文深入探讨了虚幻4引擎的主循环机制,通过分析EngineSourceRuntimeLaunchPrivateLaunchEngineLoop.cpp源代码,揭示了游戏运行过程中的核心流程和关键组件,帮助开发者理解引擎内部工作原理。
摘要由CSDN通过智能技术生成