UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
LaunchEngineLoop.cpp
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#include "LaunchEngineLoop.h"
4
10#include "Misc/MessageDialog.h"
11#include "Misc/ScopedSlowTask.h"
14#include "HAL/FileManager.h"
17#include "Misc/FileHelper.h"
24#include "Misc/AsciiSet.h"
25#include "Misc/TimeGuard.h"
26#include "Misc/Paths.h"
27#include "Misc/PathViews.h"
28#include "Misc/ConfigCacheIni.h"
29#include "Misc/CoreMisc.h"
33#include "Misc/AutomationTest.h"
34#include "Misc/CommandLine.h"
35#include "Misc/App.h"
38#include "Misc/ScopeExit.h"
39#include "Misc/StringBuilder.h"
49#include "Stats/StatsSystem.h"
51#include "Trace/Trace.inl"
55#if WITH_ENGINE
56#include "HAL/PlatformSplash.h"
57#include "SceneInterface.h"
58#include "StereoRenderUtils.h"
60#endif
61#if WITH_APPLICATION_CORE
63#endif
64#include "HAL/ThreadManager.h"
68#include "Containers/Ticker.h"
69
71#include "ProjectDescriptor.h"
73#include "Misc/UProjectInfo.h"
74#include "Misc/EngineVersion.h"
75
76#include "Misc/CoreDelegates.h"
81#include "HAL/ThreadHeartBeat.h"
82
83#include "Misc/NetworkVersion.h"
84#include "Templates/UniquePtr.h"
85
87
88#if !(IS_PROGRAM || WITH_EDITOR)
89#include "IPlatformFilePak.h"
90#endif
91
92#ifndef USE_IO_DISPATCHER
93#define USE_IO_DISPATCHER (WITH_ENGINE || WITH_IOSTORE_IN_EDITOR || !(IS_PROGRAM || WITH_EDITOR))
94#endif
95#if USE_IO_DISPATCHER
96#include "IO/IoDispatcher.h"
97#endif
98
99#if !defined(UE_WITH_IOSTOREONDEMAND)
100#define UE_WITH_IOSTOREONDEMAND 0
101#endif
102
103#if WITH_COREUOBJECT
105 #include "Misc/PackageName.h"
106 #include "UObject/UObjectHash.h"
107 #include "UObject/Package.h"
108 #include "UObject/Linker.h"
109 #include "UObject/LinkerLoad.h"
112
113 #if WITH_VERSE_VM || defined(__INTELLISENSE__)
114 #include "VerseVM/VVMVerse.h"
115 #else
117 #endif
118#endif
119
120#if WITH_EDITOR
122 #include "Styling/AppStyle.h"
123 #include "Misc/RemoteConfigIni.h"
124 #include "EditorCommandLineUtils.h"
125 #include "Input/Reply.h"
126 #include "Styling/CoreStyle.h"
127 #include "RenderingThread.h"
128 #include "RenderDeferredCleanup.h"
129 #include "Editor/EditorEngine.h"
130 #include "UnrealEdMisc.h"
131 #include "UnrealEdGlobals.h"
133 #include "Editor/UnrealEdEngine.h"
134 #include "Settings/EditorExperimentalSettings.h"
135 #include "PIEPreviewDeviceProfileSelectorModule.h"
138 #include "AnimationUtils.h"
139 #include "UObject/ICookInfo.h"
140
141 #if PLATFORM_WINDOWS
143 #include <objbase.h>
146 #endif
147#endif //WITH_EDITOR
148
149#if WITH_ENGINE
150 #include "AssetCompilingManager.h"
151 #include "Engine/GameEngine.h"
153 #include "UnrealClient.h"
154 #include "Engine/LocalPlayer.h"
159 #include "SystemSettings.h"
160 #include "EngineStats.h"
161 #include "EngineGlobals.h"
162 #include "AudioThread.h"
163 #include "AudioDeviceManager.h"
164#if !UE_BUILD_SHIPPING
165 #include "IAutomationControllerModule.h"
166#endif // !UE_BUILD_SHIPPING
167#if WITH_EDITORONLY_DATA
168 #include "DerivedDataBuild.h"
169 #include "DerivedDataCache.h"
170#endif // WITH_EDITORONLY_DATA
171 #include "DerivedDataCacheInterface.h"
173 #include "ShaderCompiler.h"
174 #include "DistanceFieldAtlas.h"
175 #include "MeshCardBuild.h"
176 #include "GlobalShader.h"
177 #include "ShaderCodeLibrary.h"
179 #include "TextureResource.h"
180 #include "Engine/Texture2D.h"
182 #include "SceneUtils.h"
183 #include "ParticleHelper.h"
184 #include "PhysicsPublic.h"
185 #include "PlatformFeatures.h"
187 #include "Commandlets/Commandlet.h"
188 #include "EngineService.h"
189 #include "TraceService.h"
190 #include "ContentStreaming.h"
191 #include "HighResScreenshot.h"
193 #include "ISessionServicesModule.h"
197 #include "Layout/WidgetPath.h"
199 #include "IMessagingModule.h"
200 #include "Engine/DemoNetDriver.h"
201 #include "LongGPUTask.h"
202 #include "RenderUtils.h"
203 #include "DynamicResolutionState.h"
204 #include "EngineModule.h"
205 #include "DumpGPU.h"
206 #include "PSOPrecacheMaterial.h"
207 #include "VisualizeTexture.h"
208
209#if !UE_SERVER
210 #include "AppMediaTimeSource.h"
212 #include "IMediaModule.h"
213 #include "HeadMountedDisplay.h"
214 #include "MRMeshModule.h"
217 #include "EngineFontServices.h"
218#endif
219
220 #include "MoviePlayer.h"
221 #include "MoviePlayerProxy.h"
222 #include "PreLoadScreenManager.h"
224
225 #include "ShaderCodeLibrary.h"
226 #include "ShaderPipelineCache.h"
227
228#if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
229 #include "ProfileVisualizerModule.h"
230#endif
231
232#if WITH_AUTOMATION_WORKER
234#endif
235
236#if WITH_ODSC
237 #include "ODSC/ODSCManager.h"
238#endif
239#endif //WITH_ENGINE
240
242
243#if WITH_ENGINE
244 #include "Tests/RHIUnitTests.h"
245#endif
246
247#if PLATFORM_MAC
248 #include "Apple/AppleAsyncTask.h"
249#endif
250
251class FSlateRenderer;
252class SViewport;
253class IPlatformFile;
255class FFeedbackContext;
256
257#if WITH_EDITOR
258 #include "FeedbackContextEditor.h"
260 #include "AudioEditorModule.h"
261#endif // WITH_EDITOR
262
263#if UE_EDITOR
264 #include "DesktopPlatformModule.h"
265 #include "TargetReceipt.h"
266#endif
267
268#define LOCTEXT_NAMESPACE "LaunchEngineLoop"
269
270#if PLATFORM_WINDOWS
272 #include <ObjBase.h>
274 #include <DbgHelp.h>
275#endif
276
277#if WITH_ENGINE
278 #include "EngineDefines.h"
279 #if ENABLE_VISUAL_LOG
281 #endif
284#endif
285
286#if defined(WITH_LAUNCHERCHECK) && WITH_LAUNCHERCHECK
287 #include "ILauncherCheckModule.h"
288#endif
289#include "String/ParseTokens.h"
290
291#if WITH_COREUOBJECT
292 #ifndef USE_LOCALIZED_PACKAGE_CACHE
293 #define USE_LOCALIZED_PACKAGE_CACHE 1
294 #endif
295#else
296 #define USE_LOCALIZED_PACKAGE_CACHE 0
297#endif
298
299#if WITH_ENGINE
301#endif
302
303#ifndef WITH_CONFIG_PATCHING
304#define WITH_CONFIG_PATCHING 0
305#endif
306
307#if PLATFORM_IOS || PLATFORM_TVOS
308#include "IOS/IOSAppDelegate.h"
309#endif
310
311#ifndef UE_MERGED_MODULES
312#define UE_MERGED_MODULES 0
313#endif
314
315#if CPUPROFILERTRACE_ENABLED
319#endif // CPUPROFILERTRACE_ENABLED
320
321#if ENABLE_NAMED_EVENTS
322// Different levels of color for scoped named events
323static const FColor FrameColor = FColor::Red;
324static const FColor SystemColor = FColor::Orange;
326#endif // ENABLE_NAMED_EVENTS
327
329
330static TAutoConsoleVariable<int32> CVarDoAsyncEndOfFrameTasksRandomize(
331 TEXT("tick.DoAsyncEndOfFrameTasks.Randomize"),
332 0,
333 TEXT("Used to add random sleeps to tick.DoAsyncEndOfFrameTasks to shake loose bugs on either thread. Also does random render thread flushes from the game thread.")
334 );
335
336static TAutoConsoleVariable<int32> CVarDoAsyncEndOfFrameTasksValidateReplicatedProperties(
337 TEXT("tick.DoAsyncEndOfFrameTasks.ValidateReplicatedProperties"),
338 0,
339 TEXT("If true, validates that replicated properties haven't changed during the Slate tick. Results will not be valid if demo.ClientRecordAsyncEndOfFrame is also enabled.")
340 );
341
342static FAutoConsoleTaskPriority CPrio_AsyncEndOfFrameGameTasks(
343 TEXT("TaskGraph.TaskPriorities.AsyncEndOfFrameGameTasks"),
344 TEXT("Task and thread priority for the experiemntal async end of frame tasks."),
348 );
349
350static TAutoConsoleVariable<float> CVarSecondsBeforeEmbeddedAppSleeps(
351 TEXT("tick.SecondsBeforeEmbeddedAppSleeps"),
352 1,
353 TEXT("When built as embedded, how many ticks to perform before sleeping")
354);
355
358{
359 TFunction<void()> TickWithSlate;
360
361public:
362
364 : TickWithSlate(InTickWithSlate)
365 , CompleteEvent(InCompleteEvent)
366 {
367 check(CompleteEvent);
368 }
369
374
376 {
377 return CPrio_AsyncEndOfFrameGameTasks.Get();
378 }
379
381
383 {
384 TickWithSlate();
385 CompleteEvent->Trigger();
386 }
387
388private:
389 FEvent* CompleteEvent;
390};
391
392// Exits the game/editor if any of the specified phrases appears in the log output
394{
395 TArray<FString> ExitPhrases;
396 FString* FoundExitPhrase = nullptr;
397public:
403 {
404 }
405 bool RequestExit() { return !IsEngineExitRequested() && FoundExitPhrase; }
406 FString RequestExitPhrase() { return FoundExitPhrase ? *FoundExitPhrase : FString(); }
407 virtual void Serialize(const TCHAR* V, ELogVerbosity::Type Verbosity, const class FName& Category) override
408 {
409 if (FoundExitPhrase || IsEngineExitRequested())
410 {
411 return;
412 }
413
414 for (auto& Phrase : ExitPhrases)
415 {
416 // look for the exit phrase, but ignore the output of the actual commandline string
417 if (FCString::Stristr(V, *Phrase) && !FCString::Stristr(V, TEXT("-testexit=")))
418 {
419 FoundExitPhrase = &Phrase;
420 break;
421 }
422 }
423 }
424};
425
426#if WITH_ENGINE && WITH_EDITOR
428 TEXT("RunCommandlet"),
429 TEXT("<Commandlet> <Args...>. NOTE: This is for debugging/iteration purposes only! Running commandlets multiple times in an editor session may result in issues!"),
430 FConsoleCommandWithArgsDelegate::CreateLambda( [](const TArray<FString>& Args)
431 {
432 if ( Args.Num() == 0 )
433 {
434 UE_LOG(LogInit, Error, TEXT("Need to specify a commandlet name to run!"));
435 return;
436 }
437
438 FString CommandletName = Args[0];
439 UClass* CommandletClass = nullptr;
440
443 if (!CommandletClass && CommandletName.FindChar('.', PeriodIdx))
444 {
445 // try to load module for commandlet specified before a period.
448 }
449 if (!CommandletClass)
450 {
451 UE_LOG(LogInit, Error, TEXT("Commandlet class '%s' not found!"), *CommandletName);
452 return;
453 }
455
456 // Execute the commandlet.
458
459 // Commandlets don't always handle -run= properly in the commandline so we'll provide them
460 // with a custom version that doesn't have it.
463 FString CommandletCommandLine = FString::Join(CmdlineArgs, TEXT(" "));
464 Commandlet->ParseParms(*CommandletCommandLine);
465
467
468 {
469 SCOPED_NAMED_EVENT_TEXT("FCoreDelegates::OnCommandletPreMain", CoreDelegatesColor);
471 }
472
474 {
475 TRACE_CPUPROFILER_EVENT_SCOPE_TEXT(*WriteToString<512>(TEXT("Commandlet Main "), Commandlet->GetFName()));
476 FTrackedActivityScope CommandletActivity(FTrackedActivity::GetEngineActivity(), *FString::Printf(TEXT("Running %s"), *Commandlet->GetName()), false, FTrackedActivity::ELight::Green);
477 ErrorLevel = Commandlet->Main(CommandletCommandLine);
478 }
479
480 {
481 SCOPED_NAMED_EVENT_TEXT("FCoreDelegates::OnCommandletPostMain", CoreDelegatesColor);
483 }
484
486
488 UE_LOG(LogInit, Display, LINE_TERMINATOR TEXT("Commandlet returned %d. Execution time: %.2f seconds"), ErrorLevel, CommandletExecutionTime);
489 })
490 );
491#endif
492
493#if defined(WITH_LAUNCHERCHECK) && defined(WITH_LAUNCHERCHECK_PAKVERIFY) && WITH_LAUNCHERCHECK && WITH_LAUNCHERCHECK_PAKVERIFY
494struct FPakValidator
495{
496 explicit FPakValidator() :
498 {
499 Handle = FCoreDelegates::PakFileMountFailedDelegate.AddLambda([this](const FString&) { bPakMountFailed = true; });
500 }
501
503 {
505 }
506
507 bool HasPakMountFailed() const { return bPakMountFailed; }
508
509 static void HandlePakMountError()
510 {
511 bool bRunVerifyInstallation = false;
512 if (ILauncherCheckModule::Get().WasRanFromLauncher())
513 {
518 LOCTEXT("Error.CorruptInstall.VerifyLauncher", "Corrupt files detected. \n\nDo you want to verify your installation?"),
519 LOCTEXT("Error.CorruptInstall.Title", "Corrupt files detected")
521 }
522 else
523 {
527 LOCTEXT("Error.CorruptInstall", "Corrupt files detected. Please verify your installation."),
528 LOCTEXT("Error.CorruptInstall.Title", "Corrupt files detected")
529 );
530 }
531
533 {
535 RequestEngineExit(TEXT("Corrupt files detected; running verify in launcher"));
536 }
537 else
538 {
539 RequestEngineExit(TEXT("Corrupt files detected; exiting"));
540 }
541 }
542
543private:
545 bool bPakMountFailed;
546};
547
548#else
550{
551 static void HandlePakMountError() {}
552 bool HasPakMountFailed() const { return false; }
553};
554
555#endif
556
557#if WITH_APPLICATION_CORE
559#endif
560static TUniquePtr<FOutputDeviceStdOutput> GScopedStdOut;
561static TUniquePtr<FOutputDeviceTestExit> GScopedTestExit;
562
567{
568 // Check if something is trying to initialize std out device twice.
569 check(!GScopedStdOut);
570
571 GScopedStdOut = MakeUnique<FOutputDeviceStdOutput>();
572 GLog->AddOutputDevice(GScopedStdOut.Get());
573}
574
575
577{
578 FString ProjectFilePathOption;
579
580 const TCHAR *CmdLine = InCmdLine;
582 FString FirstCommandLineToken = FParse::Token(CmdLine, 0);
583
584 // trim any whitespace at edges of string - this can happen if the token was quoted with leading or trailing whitespace
585 // VC++ tends to do this in its "external tools" config
586 FirstCommandLineToken.TrimStartInline();
587
588 // Output parameters
590 OutGameName = TEXT("");
591
592 if ( ( FirstCommandLineToken.Len() && !FirstCommandLineToken.StartsWith(TEXT("-"))) || ParseProjectOptionResult)
593 {
594 // The first command line argument could be the project file if it exists or the game name if not launching with a project file
597 {
599 // Here we derive the game name from the project file
601 return true;
602 }
603 else if (FPaths::IsRelative(ProjectFilePath) && FPlatformProperties::IsMonolithicBuild() == false)
604 {
605 // Full game name is assumed to be the first token
607 // Derive the project path from the game name. All games must have a uproject file, even if they are in the root folder.
609 return true;
610 }
611 }
612
613#if WITH_EDITOR
614 if (FEditorCommandLineUtils::ParseGameProjectPath(InCmdLine, OutProjectFilePath, OutGameName))
615 {
616 return true;
617 }
618#endif
619 return false;
620}
621
622#if WITH_EDITOR
624{
626 {
627 FString ProjFilePath;
628 if (FFileHelper::LoadFileToString(ProjFilePath, *(FPaths::RootDir() / TEXT("Engine/Build/InstalledProjectBuild.txt"))))
629 {
630 ProjFilePath.TrimStartAndEndInline();
631 if(ProjFilePath.Len() > 0)
632 {
635 return true;
636 }
637 }
638 }
639 return false;
640}
641#endif
642
644{
646 {
647 // Initialize GameName to an empty string. Populate it below.
649
650 FString ProjFilePath;
651 FString LocalGameName;
653 {
654 // Only set the game name if this is NOT a program...
655 if (FPlatformProperties::IsProgram() == false)
656 {
658 }
661 }
662#if WITH_EDITOR
664 {
665 // Only set the game name if this is NOT a program...
666 if (FPlatformProperties::IsProgram() == false)
667 {
669 }
672 }
673#endif
674#if UE_GAME
675 else
676 {
677 // Try to use the executable name as the game name.
680 if (LocalGameName.FindChar(TCHAR('-'), FirstCharToRemove))
681 {
683 }
685
686 // Check it's not UnrealGame, otherwise assume a uproject file relative to the game project directory
687 if (LocalGameName != TEXT("UnrealGame"))
688 {
692 }
693 }
694#endif
695
696 static bool bPrinted = false;
697 if (!bPrinted)
698 {
699 bPrinted = true;
701 {
702 UE_LOG(LogInit, Display, TEXT("Running engine for game: %s"), FApp::GetProjectName());
703 }
704 else
705 {
706 if (FPlatformProperties::RequiresCookedData())
707 {
708 UE_LOG(LogInit, Fatal, TEXT("Non-agnostic games on cooked platforms require a uproject file be specified."));
709 }
710 else
711 {
712 UE_LOG(LogInit, Display, TEXT("Running engine without a game"));
713 }
714 }
715 }
716 }
717 else
718 {
719 FString ProjFilePath;
720 FString LocalGameName;
722 {
723 if (FPlatformProperties::RequiresCookedData())
724 {
725 // Non-agnostic exes that require cooked data cannot load projects, so make sure that the LocalGameName is the GameName
727 {
728 UE_LOG(LogInit, Fatal, TEXT("Non-agnostic games cannot load projects on cooked platforms - expected [%s], found [%s]"), FApp::GetProjectName(), *LocalGameName);
729 }
730 }
731 // Only set the game name if this is NOT a program...
732 if (FPlatformProperties::IsProgram() == false)
733 {
735 }
738 }
739
740 // In a non-game agnostic exe, the game name should already be assigned by now.
742 {
743 UE_LOG(LogInit, Fatal,TEXT("Could not set game name!"));
744 }
745 }
746
747 return true;
748}
749
759
761{
762#if PLATFORM_DESKTOP && !IS_PROGRAM
763 // This is to make sure this function is not misused and is only called when the game name is set
765
766 // correct the case of the game name, if possible (unless we're running a program and the game name is already set)
768 {
770
773 {
774 if (GameName == FApp::GetProjectName()) // case insensitive compare
775 {
777 }
778 else
779 {
780 const FText Message = FText::Format(
781 NSLOCTEXT("Core", "MismatchedGameNames", "The name of the .uproject file ('{0}') must match the name of the project passed in the command line ('{1}')."),
784 if (!GIsBuildMachine)
785 {
786 UE_LOG(LogInit, Warning, TEXT("%s"), *Message.ToString());
788 }
789 FApp::SetProjectName(TEXT("")); // this disables part of the crash reporter to avoid writing log files to a bogus directory
790 if (!GIsBuildMachine)
791 {
792 exit(1);
793 }
794 UE_LOG(LogInit, Fatal, TEXT("%s"), *Message.ToString());
795 }
796 }
797 }
798#endif //PLATFORM_DESKTOP
799}
800
801
802static IPlatformFile* ConditionallyCreateFileWrapper(const TCHAR* Name, IPlatformFile* CurrentPlatformFile, const TCHAR* CommandLine, bool* OutFailedToInitialize = nullptr, bool* bOutShouldBeUsed = nullptr )
803{
805 {
806 *OutFailedToInitialize = false;
807 }
808 if ( bOutShouldBeUsed )
809 {
810 *bOutShouldBeUsed = false;
811 }
813 if (WrapperFile != nullptr && WrapperFile->ShouldBeUsed(CurrentPlatformFile, CommandLine))
814 {
815 if ( bOutShouldBeUsed )
816 {
817 *bOutShouldBeUsed = true;
818 }
819 if (WrapperFile->Initialize(CurrentPlatformFile, CommandLine) == false)
820 {
822 {
823 *OutFailedToInitialize = true;
824 }
825 // Don't delete the platform file. It will be automatically deleted by its module.
826 WrapperFile = nullptr;
827 }
828 }
829 else
830 {
831 // Make sure it won't be used.
832 WrapperFile = nullptr;
833 }
834 return WrapperFile;
835}
836
837
842{
843 OutFileOverrideFound = false;
844
845 // Get the physical platform file.
847
848 // NetworkPlatformFile can be only one of StorageServerClient, StreamingFile or NetworkFile
849 // Having a NetworkPlatformFile present prevents creation of Pakfile, CachedReadFile and SandboxFile
850 IPlatformFile* NetworkPlatformFile = nullptr;
851
852#if !UE_BUILD_SHIPPING
853 if (!NetworkPlatformFile)
854 {
855 NetworkPlatformFile = ConditionallyCreateFileWrapper(TEXT("StorageServerClient"), CurrentPlatformFile, CmdLine);
856 if (NetworkPlatformFile)
857 {
858 CurrentPlatformFile = NetworkPlatformFile;
860 // pak streaming currently needs this to be the PlatformPhysical, although it can potentially
861 // cause issues for other code that assumes PlatformPhysical only refers to the absolute lowest
862 // level for the platform
864 {
866 }
867 }
868 }
869
870 // Streaming network wrapper (it has a priority over normal network wrapper)
871 bool bShouldInitializeNetwork = !NetworkPlatformFile;
873 {
874 bool bShouldUseStreamingFile = false;
875 NetworkPlatformFile = ConditionallyCreateFileWrapper(TEXT("StreamingFile"), CurrentPlatformFile, CmdLine, &bShouldInitializeNetwork, &bShouldUseStreamingFile);
876 if (NetworkPlatformFile)
877 {
878 CurrentPlatformFile = NetworkPlatformFile;
880 }
881
882 // if streaming network platform file was tried this loop don't try this one
883 // Network file wrapper (only create if the streaming wrapper hasn't been created)
884 if (!bShouldUseStreamingFile && !NetworkPlatformFile)
885 {
886 NetworkPlatformFile = ConditionallyCreateFileWrapper(TEXT("NetworkFile"), CurrentPlatformFile, CmdLine, &bShouldInitializeNetwork);
887 if (NetworkPlatformFile)
888 {
889 CurrentPlatformFile = NetworkPlatformFile;
891 }
892 }
893
895 {
896 FString HostIpString;
897 FParse::Value(CmdLine, TEXT("-FileHostIP="), HostIpString);
898#if PLATFORM_REQUIRES_FILESERVER
899 FPlatformMisc::LowLevelOutputDebugStringf(TEXT("Failed to connect to file server at %s. RETRYING in 5s.\n"), *HostIpString);
900 FPlatformProcess::Sleep(5.0f);
901 constexpr uint32 Result = 2;
902#else //PLATFORM_REQUIRES_FILESERVER
903 // note that this can't be localized because it happens before we connect to a filserver - localizing would cause ICU to try to load.... from over the file server connection!
904 FString Error = FString::Printf(TEXT("Failed to connect to any of the following file servers:\n\n %s\n\nWould you like to try again? No will fallback to local disk files, Cancel will quit."), *HostIpString.Replace( TEXT("+"), TEXT("\n ")));
906#endif //PLATFORM_REQUIRES_FILESERVER
907
908 if (Result == EAppReturnType::No)
909 {
910 break;
911 }
912 else if (Result == EAppReturnType::Cancel)
913 {
914 // Cancel - return a failure, and quit
915 return false;
916 }
917 }
918 }
919#endif
920 if (UE::IsUsingZenPakFileStreaming() || !NetworkPlatformFile)
921 {
922 FPakValidator Validator;
923 IPlatformFile* PlatformFile = ConditionallyCreateFileWrapper(TEXT("PakFile"), CurrentPlatformFile, CmdLine);
924 if (Validator.HasPakMountFailed())
925 {
927 return false;
928 }
929 else if (PlatformFile)
930 {
931 CurrentPlatformFile = PlatformFile;
933 }
934 }
935
936 if (!NetworkPlatformFile)
937 {
938 IPlatformFile* PlatformFile = ConditionallyCreateFileWrapper(TEXT("CachedReadFile"), CurrentPlatformFile, CmdLine);
939 if (PlatformFile)
940 {
941 CurrentPlatformFile = PlatformFile;
943 }
944
945 PlatformFile = ConditionallyCreateFileWrapper(TEXT("SandboxFile"), CurrentPlatformFile, CmdLine);
946 if (PlatformFile)
947 {
948 CurrentPlatformFile = PlatformFile;
950 }
951 }
952
953#if !UE_BUILD_SHIPPING
954 // Try to create file profiling wrapper
955 {
956 IPlatformFile* PlatformFile = ConditionallyCreateFileWrapper(TEXT("ProfileFile"), CurrentPlatformFile, CmdLine);
957 if (PlatformFile)
958 {
959 CurrentPlatformFile = PlatformFile;
961 }
962 }
963 {
964 IPlatformFile* PlatformFile = ConditionallyCreateFileWrapper(TEXT("SimpleProfileFile"), CurrentPlatformFile, CmdLine);
965 if (PlatformFile)
966 {
967 CurrentPlatformFile = PlatformFile;
969 }
970 }
971 // Try and create file timings stats wrapper
972 {
973 IPlatformFile* PlatformFile = ConditionallyCreateFileWrapper(TEXT("FileReadStats"), CurrentPlatformFile, CmdLine);
974 if (PlatformFile)
975 {
976 CurrentPlatformFile = PlatformFile;
978 }
979 }
980 // Try and create file open log wrapper (lists the order files are first opened)
981 {
982 IPlatformFile* PlatformFile = ConditionallyCreateFileWrapper(TEXT("FileOpenLog"), CurrentPlatformFile, CmdLine);
983 if (PlatformFile)
984 {
985 CurrentPlatformFile = PlatformFile;
987 }
988 }
989#endif //#if !UE_BUILD_SHIPPING
990
991 // Wrap the above in a file logging singleton if requested
992 {
993 IPlatformFile* PlatformFile = ConditionallyCreateFileWrapper(TEXT("LogFile"), CurrentPlatformFile, CmdLine);
994 if (PlatformFile)
995 {
996 CurrentPlatformFile = PlatformFile;
998 }
999 }
1000
1001 // If our platform file is different than it was when we started, then an override was used
1003
1004 return true;
1005}
1006
1007#if !UE_BUILD_SHIPPING
1013{
1014 bChanged = false;
1015
1016 if (const FConfigSection* Section = Config.FindSection(TEXT("CommandLineAliases")))
1017 {
1018 TArray<FString> Tokens;
1019 {
1020 const TCHAR* Stream = FCommandLine::Get();
1021 FString NextToken;
1022 while (FParse::Token(Stream, NextToken, false))
1023 {
1024 Tokens.Add(NextToken);
1025 }
1026 }
1027
1028 for (FConfigSection::TConstIterator ConfigIt(*Section); ConfigIt; ++ConfigIt)
1029 {
1030 FString Key = FString(TEXT("-")) + ConfigIt.Key().ToString();
1032 while (TokenIt)
1033 {
1034 if (PrevExpansions.Contains(*TokenIt))
1035 {
1036 TokenIt.RemoveCurrent();
1037 bChanged = true;
1038 continue;
1039 }
1040
1041 if (*TokenIt == Key)
1042 {
1044 *TokenIt = ConfigIt.Value().GetValue();
1045 bChanged = true;
1046 }
1047
1048 ++TokenIt;
1049 }
1050 }
1051
1052 if (bChanged)
1053 {
1054 FString NewCommandLine = FString::Join(Tokens, TEXT(" "));
1056 }
1057 }
1058}
1059
1065{
1066 bChanged = false;
1067
1068 auto RemoveExpansion = [&bChanged]()
1069 {
1071 FString Left;
1072 FString Right;
1073 if (NewCommandLine.Split(TEXT("-CmdLineFile="), &Left, &Right))
1074 {
1075 FString NextToken;
1076 const TCHAR* Stream = *Right;
1077 if (FParse::Token(Stream, NextToken, /*bUseEscape=*/ false))
1078 {
1079 Right = FString(Stream);
1080 }
1081
1082 NewCommandLine = Left + TEXT(" ") + Right;
1083 NewCommandLine.TrimStartAndEndInline();
1085 bChanged = true;
1086 }
1087 };
1088
1089 auto TryProcessFile = [&RemoveExpansion, &bChanged](const FString& InFilePath)
1090 {
1091 FString FileCmds;
1093 {
1094 UE_LOG(LogInit, Log, TEXT("Inserting commandline from file: %s, %s"), *InFilePath, *FileCmds);
1095
1096 FileCmds = FileCmds.TrimStartAndEnd();
1097 if (FileCmds.Len() == 0)
1098 {
1100 return true;
1101 }
1102
1104 FString Left;
1105 FString Right;
1106 if (NewCommandLine.Split(TEXT("-CmdLineFile="), &Left, &Right))
1107 {
1108 FString NextToken;
1109 const TCHAR* Stream = *Right;
1110 if (FParse::Token(Stream, NextToken, /*bUseEscape=*/ false))
1111 {
1112 Right = FString(Stream);
1113 }
1114
1115 NewCommandLine = Left + TEXT(" ") + FileCmds + TEXT(" ") + Right;
1116 NewCommandLine.TrimStartAndEndInline();
1118 bChanged = true;
1119 return true;
1120 }
1121 }
1122
1123 return false;
1124 };
1125
1126 FString CmdLineFile;
1127 while (FParse::Value(FCommandLine::Get(), TEXT("-CmdLineFile="), CmdLineFile))
1128 {
1129 if (!CmdLineFile.EndsWith(TEXT(".txt")))
1130 {
1131 UE_LOG(LogInit, Warning, TEXT("Can only load commandline files ending with .txt, can't load: %s"), *CmdLineFile);
1133 continue;
1134 }
1135
1136 if (PrevExpansions.Contains(CmdLineFile))
1137 {
1138 // If already expanded, just remove it
1140 continue;
1141 }
1142
1144 if (!bFoundFile && FPaths::ProjectDir().Len() > 0)
1145 {
1146 const FString ProjectDir = FPaths::ProjectDir();
1147 bFoundFile = TryProcessFile(ProjectDir + CmdLineFile);
1148 if (!bFoundFile)
1149 {
1150 const FString ProjectPluginsDir = ProjectDir + TEXT("Plugins/");
1152 IFileManager::Get().IterateDirectory(*ProjectPluginsDir, [&](const TCHAR* FilenameOrDirectory, bool bIsDirectory) -> bool
1153 {
1154 if (bIsDirectory && TryProcessFile(FString(FilenameOrDirectory) + TEXT("/") + CmdLineFile))
1155 {
1156 bFoundFile = true;
1157 return false;
1158 }
1159 return true;
1160 });
1161 }
1162 }
1163
1164 if (!bFoundFile)
1165 {
1166 UE_LOG(LogInit, Warning, TEXT("Failed to load commandline file '%s'."), *CmdLineFile);
1168 continue;
1169 }
1170
1172 }
1173}
1174#endif
1175
1177{
1179 {
1180 // Verify this is a legitimate game name
1181 // Launched with a game name. See if the <GameName> folder exists. If it doesn't, it could instead be <GameName>Game
1183 if (FPlatformFileManager::Get().GetPlatformFile().DirectoryExists(*NonSuffixedGameFolder) == false)
1184 {
1185 const FString SuffixedGameFolder = NonSuffixedGameFolder + TEXT("Game");
1186 if (FPlatformFileManager::Get().GetPlatformFile().DirectoryExists(*SuffixedGameFolder))
1187 {
1188 return true;
1189 }
1190 }
1191 }
1192
1193 return false;
1194}
1195
1196
1198{
1199 // If we are launching without a game name or project file, we should use the last used project file, if it exists
1203 {
1204 if ( RecentProjectFileContents.Len() )
1205 {
1206 const FString AutoLoadInProgressFilename = AutoLoadProjectFileName + TEXT(".InProgress");
1207 if ( FPlatformFileManager::Get().GetPlatformFile().FileExists(*AutoLoadInProgressFilename) )
1208 {
1209 // We attempted to auto-load a project but the last run did not make it to UEditorEngine::InitEditor.
1210 // This indicates that there was a problem loading the project.
1211 // Do not auto-load the project, instead load normally until the next time the editor starts successfully.
1212 UE_LOG(LogInit, Display, TEXT("There was a problem auto-loading %s. Auto-load will be disabled until the editor successfully starts up with a project."), *RecentProjectFileContents);
1213 }
1214 else if ( FPlatformFileManager::Get().GetPlatformFile().FileExists(*RecentProjectFileContents) )
1215 {
1216 // The previously loaded project file was found. Change the game name here and update the project file path
1219 UE_LOG(LogInit, Display, TEXT("Loading recent project file: %s"), *RecentProjectFileContents);
1220
1221 // Write a file indicating that we are trying to auto-load a project.
1222 // This file prevents auto-loading of projects for as long as it exists. It is a detection system for failed auto-loads.
1223 // The file is deleted in UEditorEngine::InitEditor, thus if the load does not make it that far then the project will not be loaded again.
1225 }
1226 }
1227 }
1228}
1229
1230#if WITH_ENGINE
1231void OnStartupContentMounted(FInstallBundleRequestResultInfo Result, bool bDumpEarlyConfigReads, bool bDumpEarlyPakFileReads, bool bReloadConfig, bool bForceQuitAfterEarlyReads);
1232#endif
1233void DumpEarlyReads(bool bDumpEarlyConfigReads, bool bDumpEarlyPakFileReads, bool bForceQuitAfterEarlyReads);
1235
1236#if !UE_BUILD_SHIPPING
1238{
1239private:
1240 struct FFileInPakFileHistory
1241 {
1242 FString PakFileName;
1243 FString FileName;
1244 };
1245 friend uint32 GetTypeHash(const FFileInPakFileHistory& H)
1246 {
1247 uint32 Hash = GetTypeHash(H.PakFileName);
1248 Hash = HashCombine(Hash, GetTypeHash(H.FileName));
1249 return Hash;
1250 }
1251 friend bool operator==(const FFileInPakFileHistory& A, const FFileInPakFileHistory& B)
1252 {
1253 return A.PakFileName == B.PakFileName && A.FileName == B.FileName;
1254 }
1255
1257 FCriticalSection HistoryLock;
1258
1259 void OnFileOpenedForRead(const TCHAR* PakFileName, const TCHAR* FileName)
1260 {
1261 //UE_LOG(LogInit, Warning, TEXT("OnFileOpenedForRead %u: %s - %s"), FPlatformTLS::GetCurrentThreadId(), PakFileName, FileName);
1262
1263 FScopeLock ScopeLock(&HistoryLock);
1264 History.Emplace(FFileInPakFileHistory{ PakFileName, FileName });
1265 }
1266
1267public:
1269 {
1270 FCoreDelegates::GetOnFileOpenedForReadFromPakFile().AddRaw(this, &FFileInPakFileHistoryHelper::OnFileOpenedForRead);
1271 }
1272
1277
1279 {
1280 FScopeLock ScopeLock(&HistoryLock);
1281
1282 History.Sort([](const FFileInPakFileHistory& A, const FFileInPakFileHistory& B)
1283 {
1284 if (A.PakFileName == B.PakFileName)
1285 {
1286 return A.FileName < B.FileName;
1287 }
1288
1289 return A.PakFileName < B.PakFileName;
1290 });
1291
1292 const FString SavePath = FPaths::ProjectLogDir() / TEXT("FilesLoadedFromPakFiles.csv");
1293
1295
1296 auto WriteLine = [Writer](FString&& Line)
1297 {
1298 UE_LOG(LogInit, Display, TEXT("%s"), *Line);
1300 Writer->Serialize((UTF8CHAR*)UTF8String.Get(), UTF8String.Length());
1301 };
1302
1303 UE_LOG(LogInit, Display, TEXT("Dumping History of files read from Paks to %s"), *SavePath);
1304 UE_LOG(LogInit, Display, TEXT("Begin History of files read from Paks"));
1305 UE_LOG(LogInit, Display, TEXT("------------------------------------------------------"));
1306 WriteLine(FString::Printf(TEXT("PakFile, File")));
1307 for (const FFileInPakFileHistory& H : History)
1308 {
1309 WriteLine(FString::Printf(TEXT("%s, %s"), *H.PakFileName, *H.FileName));
1310 }
1311 UE_LOG(LogInit, Display, TEXT("------------------------------------------------------"));
1312 UE_LOG(LogInit, Display, TEXT("End History of files read from Paks"));
1313
1314 delete Writer;
1315 Writer = nullptr;
1316 }
1317};
1319#endif // !UE_BUILD_SHIPPING
1320
1322{
1323#if !UE_BUILD_SHIPPING
1325#endif
1326}
1327
1329{
1330#if !UE_BUILD_SHIPPING
1332 {
1333 FileInPakFileHistoryHelper->DumpHistory();
1334 }
1335#endif
1336}
1337
1339{
1340#if !UE_BUILD_SHIPPING
1342#endif
1343}
1344
1345
1346
1347/*-----------------------------------------------------------------------------
1348 FEngineLoop implementation.
1349-----------------------------------------------------------------------------*/
1350
1352#if WITH_ENGINE
1353 : EngineService(nullptr)
1354#endif
1355{ }
1356
1357
1358static FString OriginalProjectModuleName;
1359static FString ReplacementProjectModuleName;
1360
1362{
1363 OriginalProjectModuleName = InOriginalProjectModuleName;
1364 ReplacementProjectModuleName = InReplacementProjectModuleName;
1365 FPlatformMisc::LowLevelOutputDebugStringf(TEXT("OverrideProjectModule : OriginalProjectModuleName=%s, ReplacementProjectModuleName=%s\n"), *OriginalProjectModuleName, *ReplacementProjectModuleName);
1366
1367}
1368
1370{
1371 FString CmdLine = FCommandLine::BuildFromArgV(nullptr, ArgC, ArgV, AdditionalCommandline);
1372
1373 // send the command line without the exe name
1374 return GEngineLoop.PreInit(*CmdLine);
1375}
1376
1377#if WITH_ENGINE
1378bool IsServerDelegateForOSS(FName WorldContextHandle)
1379{
1381 {
1382 return true;
1383 }
1384
1385 UWorld* World = nullptr;
1386#if WITH_EDITOR
1387 if (WorldContextHandle != NAME_None)
1388 {
1389 const FWorldContext* WorldContext = GEngine->GetWorldContextFromHandle(WorldContextHandle);
1390 if (WorldContext)
1391 {
1392 check(WorldContext->WorldType == EWorldType::Game || WorldContext->WorldType == EWorldType::PIE);
1393 World = WorldContext->World();
1394 }
1395 }
1396#endif
1397
1398 if (!World)
1399 {
1400 UGameEngine* GameEngine = Cast<UGameEngine>(GEngine);
1401 if (GameEngine)
1402 {
1403 World = GameEngine->GetGameWorld();
1404 }
1405 else
1406 {
1407 // The calling code didn't pass in a world context and really should have
1409 {
1410 World = GWorld;
1411 }
1412
1413#if !WITH_DEV_AUTOMATION_TESTS
1414 // Not having a world to make the right determination is a bad thing
1415 // In the editor during PIE this will confuse the individual PIE windows and their associated online components
1416 UE_CLOG(World == nullptr, LogInit, Error, TEXT("Failed to determine if OSS is server in PIE, OSS requests will fail"));
1417#endif
1418 }
1419 }
1420
1421 ENetMode NetMode = World ? World->GetNetMode() : NM_Standalone;
1422 return (NetMode == NM_ListenServer || NetMode == NM_DedicatedServer);
1423}
1424#endif
1425
1426#if WITH_ENGINE && CSV_PROFILER
1428{
1429 if (FCsvProfiler::Get()->IsCapturing())
1430 {
1433 {
1434#if !UE_BUILD_SHIPPING
1436 float ProcessUsagePercent = 0.f, IdleUsagePercent = 0.f;
1438 {
1440 CSV_CUSTOM_STAT_GLOBAL(CPUUsage_Idle, IdleUsagePercent, ECsvCustomStatOp::Set);
1441 }
1442#endif
1443
1444 }
1445#if CSV_PROFILER_ALLOW_DEBUG_FEATURES
1446 // Handle CsvExecCmds for this frame
1447 if (GEngine && GWorld)
1448 {
1450 FCsvProfiler::Get()->GetFrameExecCommands(FrameCommands);
1451 for (FString Cmd : FrameCommands)
1452 {
1453 CSV_EVENT_GLOBAL(TEXT("CsvExecCommand : %s"), *Cmd);
1454
1455 // Try to execute on the local player
1456 bool bExecuted = false;
1457 for (FConstPlayerControllerIterator Iterator = GWorld->GetPlayerControllerIterator(); Iterator; ++Iterator)
1458 {
1459 APlayerController* PlayerController = Iterator->Get();
1460 if (PlayerController)
1461 {
1462 if (ULocalPlayer* LocalPlayer = Cast<ULocalPlayer>(PlayerController->Player))
1463 {
1464 LocalPlayer->Exec(GWorld, *Cmd, *GLog);
1465 bExecuted = true;
1466 }
1467 }
1468 }
1469 if (!bExecuted)
1470 {
1471 // Fallback to GEngine exec
1472 GEngine->Exec(GWorld, *Cmd);
1473 }
1474 }
1475 }
1476#endif // CSV_PROFILER_ALLOW_DEBUG_FEATURES
1477 }
1478}
1479
1480#if !UE_BUILD_SHIPPING
1482#endif
1483
1484static void UpdateCoreCsvStats_EndFrame()
1485{
1488 {
1489 CSV_CUSTOM_STAT_MINIMAL_GLOBAL(RenderThreadTime, FPlatformTime::ToMilliseconds(GRenderThreadTime), ECsvCustomStatOp::Set);
1490 CSV_CUSTOM_STAT_MINIMAL_GLOBAL(GameThreadTime, FPlatformTime::ToMilliseconds(GGameThreadTime), ECsvCustomStatOp::Set);
1495 {
1497 }
1498 if (GInputLatencyTime > 0)
1499 {
1500 CSV_CUSTOM_STAT_MINIMAL_GLOBAL(InputLatencyTime, FPlatformTime::ToMilliseconds64(GInputLatencyTime), ECsvCustomStatOp::Set);
1501 }
1503 float PhysicalMBFree = float(MemoryStats.AvailablePhysical / 1024) / 1024.0f;
1504#if !UE_BUILD_SHIPPING
1505 // Subtract any extra development memory from physical free. This can result in negative values in cases where we would have crashed OOM
1507#endif
1509
1510#if !UE_BUILD_SHIPPING && !CSV_PROFILER_MINIMAL
1511 float TargetFPS = 30.0f;
1513 if (MaxFPSCVar && MaxFPSCVar->GetFloat() > 0)
1514 {
1516 }
1517 CSV_CUSTOM_STAT_GLOBAL(MaxFrameTime, 1000.0f / TargetFPS, ECsvCustomStatOp::Set);
1518
1520 {
1521 static const auto CVarPerProcessGPUStats = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.GPUStatisticsPerProcess"));
1522 FRHIGPUUsageFractions GPUUsage = RHIGetGPUUsage(/* GPUIndex = */ 0);
1523 CSV_CUSTOM_STAT(GPUUsage, Clock, GPUUsage.ClockScaling * 100.0f, ECsvCustomStatOp::Set);
1524 CSV_CUSTOM_STAT(GPUUsage, Usage, GPUUsage.CurrentProcessMHz * 100.0f, ECsvCustomStatOp::Set);
1525 CSV_CUSTOM_STAT(GPUUsage, Memory, GPUUsage.CurrentProcessMemoryUsage * 100.0f, ECsvCustomStatOp::Set);
1526 CSV_CUSTOM_STAT(GPUUsage, ExternalUsage, GPUUsage.ExternalProcessesMHz * 100.0f, ECsvCustomStatOp::Set);
1527 CSV_CUSTOM_STAT(GPUUsage, ExternalMemory, GPUUsage.ExternalProcessMemoryUsage * 100.0f, ECsvCustomStatOp::Set);
1528 }
1529#endif
1530 }
1531}
1532#endif // WITH_ENGINE && CSV_PROFILER
1533
1534#if WITH_ENGINE
1536{
1537 static void AppWillDeactivate()
1538 {
1539 UE_LOG( LogCore, Display, TEXT("AppLifetime: Application will deactivate") );
1540 CSV_EVENT_GLOBAL(TEXT("App_WillDeactivate"));
1541 }
1542
1543 static void AppHasReactivated()
1544 {
1545 UE_LOG( LogCore, Display, TEXT("AppLifetime: Application has reactivated") );
1546 CSV_EVENT_GLOBAL(TEXT("App_HasReactivated"));
1547 }
1548
1549 static void AppWillEnterBackground()
1550 {
1551 UE_LOG( LogCore, Display, TEXT("AppLifetime: Application will enter background") );
1552 CSV_EVENT_GLOBAL(TEXT("App_WillEnterBackground"));
1553 }
1554
1555 static void AppHasEnteredForeground()
1556 {
1557 UE_LOG( LogCore, Display, TEXT("AppLifetime: Application has entered foreground") );
1558 CSV_EVENT_GLOBAL(TEXT("App_HasEnteredForeground"));
1559 }
1560
1561 static void Init()
1562 {
1565 FCoreDelegates::ApplicationWillEnterBackgroundDelegate.AddStatic(AppWillEnterBackground);
1567 }
1568}
1569#endif //WITH_ENGINE
1570
1571static void UpdateGInputTime()
1572{
1574}
1575
1576static TArray<FString> TokenizeCommandline(const TCHAR* CmdLine, bool bRetainQuotes)
1577{
1578 TArray<FString> TokenArray;
1579
1580 const TCHAR* ParsedCmdLine = CmdLine;
1581
1582 while (*ParsedCmdLine)
1583 {
1584 FString Token;
1585
1586 // skip over whitespace to look for a quote
1588 {
1589 ParsedCmdLine++;
1590 }
1591
1592 // if we want to keep quotes around the token, and the first character is a quote, then FToken::Parse
1593 // will remove the quotes, so put them back
1594 if (bRetainQuotes && (*ParsedCmdLine == TEXT('"')))
1595 {
1596 FParse::Token(ParsedCmdLine, Token, 0);
1597 Token = FString::Printf(TEXT("\"%s\""), *Token);
1598 }
1599 else
1600 {
1601 FParse::Token(ParsedCmdLine, Token, 0);
1602 Token.TrimStartAndEndInline();
1603 }
1604
1605 if (!Token.IsEmpty())
1606 {
1607 TokenArray.Add(MoveTemp(Token));
1608 }
1609 }
1610
1611 return MoveTemp(TokenArray);
1612}
1613
1616{
1617 GameName,
1620 Unknown
1621};
1622
1631static FString ExtractGameStringArgument(TArray<FString>& TokenArray, TArray<FString>& QuotedTokenArray, EGameStringType& OutStringType)
1632{
1633 for (int32 I = 0; I < TokenArray.Num(); ++I)
1634 {
1635 FString NormalizedToken = TokenArray[I];
1636
1637 // Path returned by FPaths::GetProjectFilePath() is normalized, so may have symlinks and ~ resolved and may differ from the original path to .uproject passed in the command line
1639
1640 const bool bTokenIsGameName = (FApp::HasProjectName() && TokenArray[I] == FApp::GetProjectName());
1643
1645 {
1646 if (bTokenIsGameName)
1647 {
1649 }
1651 {
1653 }
1655 {
1657 }
1658
1659 FString Result = TokenArray[I];
1660
1661 TokenArray.RemoveAt(I);
1662 QuotedTokenArray.RemoveAt(I);
1663
1664 return Result;
1665 }
1666 }
1667
1669
1670 return FString();
1671}
1672
1673#if WITH_EDITOR
1674static void GenerateShaderHeaders()
1675{
1676 //Generate shader headers for all the shader platforms. It's necessary for the cook. I don't do it in the cook commandlet
1677 //because it's not early enough.
1679 if (PlatformModule)
1680 {
1681 const TArray<ITargetPlatform*>& ActivePlatforms = PlatformModule->GetActiveTargetPlatforms();
1683 {
1685 Platform->GetAllTargetedShaderFormats(ShaderPlatformNameArray);
1686
1687 for (const FName& ShaderPlatformName : ShaderPlatformNameArray)
1688 {
1690 }
1691 }
1692 }
1693}
1694#endif // #if WITH_EDITOR
1695
1698
1700{
1703 SCOPED_BOOT_TIMING("FEngineLoop::PreInitPreStartupScreen");
1704
1705 // GLog is initialized lazily and its default primary thread is the thread that initialized it.
1706 // This lazy initialization can happen during initialization of a DLL, which Windows does on a
1707 // worker thread, which makes that worker thread the primary thread. Make this the primary thread
1708 // until initialization is far enough along to try to start a dedicated primary thread.
1709 GLog->SetCurrentThreadAsPrimaryThread();
1710
1711 // Most targets have the backlog enabled by default. Enable it as early as possible here for
1712 // cases where it is disabled by default. It will be disabled when module loading is complete.
1713 GLog->EnableBacklog(true);
1714
1715 // Command line option for enabling named events
1716 if (FParse::Param(CmdLine, TEXT("statnamedevents")))
1717 {
1719 }
1720
1721 if (FParse::Param(CmdLine, TEXT("verbosenamedevents")))
1722 {
1725 }
1726
1727
1728 // Set the flag for whether we've build DebugGame instead of Development. The engine does not know this (whereas the launch module does) because it is always built in development.
1729#if UE_BUILD_DEVELOPMENT && defined(UE_BUILD_DEVELOPMENT_WITH_DEBUGGAME) && UE_BUILD_DEVELOPMENT_WITH_DEBUGGAME
1730 FApp::SetDebugGame(true);
1731#endif
1732
1733#if PLATFORM_WINDOWS
1734 // Register a handler for Ctrl-C so we've effective signal handling from the outset.
1736#endif // PLATFORM_WINDOWS
1737
1738#if BUILD_EMBEDDED_APP
1739#ifdef EMBEDDED_LINKER_GAME_HELPER_FUNCTION
1742#endif
1744 FEmbeddedCommunication::KeepAwake(TEXT("Startup"), false);
1745#endif
1746
1748
1750
1751#if !UE_BUILD_SHIPPING
1752 if (FParse::Param(CmdLine, TEXT("IgnoreDebugger")))
1753 {
1754 GIgnoreDebugger = true;
1755 }
1756#endif // !UE_BUILD_SHIPPING
1757
1758 // Switch into executable's directory.
1759#if !defined(DISABLE_CWD_CHANGES) || DISABLE_CWD_CHANGES==0
1761#endif
1762
1763 // this is set later with shorter command lines, but we want to make sure it is set ASAP as some subsystems will do the tests themselves...
1764 // also realize that command lines can be pulled from the network at a slightly later time.
1765 if (!FCommandLine::Set(CmdLine))
1766 {
1767 // Fail, shipping builds will crash if setting command line fails
1768 return -1;
1769 }
1770
1771 // Avoiding potential exploits by not exposing command line overrides in the shipping games.
1772#if !UE_BUILD_SHIPPING && WITH_EDITORONLY_DATA
1773 // Retrieve additional command line arguments from environment variable.
1774 FString Env = FPlatformMisc::GetEnvironmentVariable(TEXT("UE-CmdLineArgs")).TrimStart();
1775 if (Env.Len())
1776 {
1777 UE_LOG(LogInit, Log, TEXT("Inserting commandline from UE-CmdLineArgs: %s"), *Env);
1778
1779 // Append the command line environment after inserting a space as we can't set it in the
1780 // environment.
1781 FCommandLine::Append(TEXT(" -EnvAfterHere "));
1783 CmdLine = FCommandLine::Get();
1784 }
1785#endif
1786
1787 // Name of project file before normalization (as specified in command line).
1788 // Used to fixup project name if necessary.
1790
1791 {
1792 SCOPED_BOOT_TIMING("LaunchSetGameName");
1793
1794 // Set GameName, based on the command line
1796 {
1797 // If it failed, do not continue
1798 return 1;
1799 }
1800 }
1801
1802 // Initialize trace
1805
1806 // disable/enable LLM based on commandline
1807 {
1808 SCOPED_BOOT_TIMING("LLM Init");
1809 LLM(FLowLevelMemTracker::Get().ProcessCommandLine(CmdLine));
1810#if MEMPRO_ENABLED
1811 FMemProProfiler::Init(CmdLine);
1812#endif
1813 }
1814 LLM_SCOPE(ELLMTag::EnginePreInitMemory);
1815
1816 {
1817 SCOPED_BOOT_TIMING("InitTaggedStorage");
1819 }
1820
1821#if WITH_ENGINE
1823#endif
1824 FCoreDelegates::OnSamplingInput.AddStatic(UpdateGInputTime);
1825
1826#if defined(WITH_LAUNCHERCHECK) && WITH_LAUNCHERCHECK && !WITH_EDITOR
1827 if (ILauncherCheckModule::Get().WasRanFromLauncher() == false)
1828 {
1829 // Tell Launcher to run us instead
1831 // We wish to exit
1832 RequestEngineExit(TEXT("Run outside of launcher; restarting via launcher"));
1833 return 1;
1834 }
1835#endif
1836
1837#if WITH_APPLICATION_CORE
1838 {
1839 SCOPED_BOOT_TIMING("CreateConsoleOutputDevice");
1840 // Initialize log console here to avoid statics initialization issues when launched from the command line.
1842 }
1843#endif
1844
1845 // Initialize std out device as early as possible if requested in the command line
1846#if PLATFORM_DESKTOP
1847 // consoles don't typically have stdout, and FOutputDeviceDebug is responsible for echoing logs to the
1848 // terminal
1849 if (FParse::Param(FCommandLine::Get(), TEXT("stdout")))
1850 {
1852 }
1853#endif
1854
1855 if (FParse::Param(CmdLine, TEXT("UTF8Output")))
1856 {
1857 // UE_DEPRECATED(5.6, "This comment exists to describe when -UTF8Output was deprecated and allow finding it in a search for UE 5.6 deprecations.")
1858 UE_LOG(LogInit, Display, TEXT("Output is UTF-8 by default. Use of -UTF8Output on the command is deprecated and can be removed."));
1859 }
1860
1861// If we are in Debug, Development, or Test/Shipping with ALLOW_PROFILEGPU... enabled, then automatically allow draw events.
1862// Command lines allow disabling of draw events if WITH_PROGILEGPU is enabled. Test/Shipping on their own require explicit opt in.
1863#if WITH_PROFILEGPU
1864 if (!FParse::Param(FCommandLine::Get(), TEXT("nodrawevents")))
1865 {
1866 SetEmitDrawEvents(true);
1867 }
1868// Continue to protect shipping build from emitdrawevents (if needed in shipping, ALLOW_PROFILEGPU_IN_SHIPPING should be used instead to enable WITH_PROFILEGPU)
1869#elif !UE_BUILD_SHIPPING
1870 if (FParse::Param(FCommandLine::Get(), TEXT("emitdrawevents")))
1871 {
1872 SetEmitDrawEvents(true);
1873 }
1874#endif
1875
1876#if !UE_BUILD_SHIPPING
1877 if (FPlatformProperties::SupportsQuit())
1878 {
1879 FString ExitPhrases;
1880 if (FParse::Value(FCommandLine::Get(), TEXT("testexit="), ExitPhrases))
1881 {
1883 if (ExitPhrases.ParseIntoArray(ExitPhrasesList, TEXT("+"), true) > 0)
1884 {
1886 GLog->AddOutputDevice(GScopedTestExit.Get());
1887 }
1888 }
1889 }
1890
1891 // Activates malloc frame profiler from the command line
1892 // Recommend enabling bGenerateSymbols to ensure callstacks can resolve and bRetainFramePointers to ensure frame pointers remain valid.
1893 // Also disabling the hitch detector ALLOW_HITCH_DETECTION=0 helps ensure quicker more accurate runs.
1894 if (FParse::Param(FCommandLine::Get(), TEXT("mallocframeprofiler")))
1895 {
1897 UE::Private::GMalloc = FMallocFrameProfiler::OverrideIfEnabled(UE::Private::GMalloc);
1898 }
1899#endif // !UE_BUILD_SHIPPING
1900
1901 // Switch into executable's directory (may be required by some of the platform file overrides)
1902#if !defined(DISABLE_CWD_CHANGES) || DISABLE_CWD_CHANGES==0
1904#endif
1905
1906 // This fixes up the relative project path, needs to happen before we set platform file paths
1907 if (FPlatformProperties::IsProgram() == false)
1908 {
1909 SCOPED_BOOT_TIMING("Fix up the relative project path");
1910
1912 {
1914 if (FPaths::FileExists(ProjPath) == false)
1915 {
1916 // display it multiple ways, it's very important error message...
1917 FPlatformMisc::LowLevelOutputDebugStringf(TEXT("Project file not found: %s\n"), *ProjPath);
1918 UE_LOG(LogInit, Display, TEXT("Project file not found: %s"), *ProjPath);
1919 UE_LOG(LogInit, Display, TEXT("\tAttempting to find via project info helper."));
1920 // Use the uprojectdirs
1922 if (GameProjectFile.IsEmpty() == false)
1923 {
1924 UE_LOG(LogInit, Display, TEXT("\tFound project file %s."), *GameProjectFile);
1926
1927 // Fixup command line if project file wasn't found in specified directory to properly parse next arguments.
1928 FString OldCommandLine = FString(FCommandLine::Get());
1931 CmdLine = FCommandLine::Get();
1932 }
1933 }
1934 }
1935 }
1936
1937#if !IS_PROGRAM && !IS_MONOLITHIC
1939#endif
1942 {
1944#if !IS_MONOLITHIC
1945#if !IS_PROGRAM
1947#endif
1948
1949 // Strip suffix "-Platform-Config" to allow building module name to load: "App" + "-ModuleName" + "-Platform-Config"
1953 FString BaseSuffix;
1955 {
1957 if (BasePrefix.FindLastChar(TEXT('-'), LastDash))
1958 {
1960
1962 if (BasePrefix.FindLastChar(TEXT('-'), LastDash))
1963 {
1964 BasePrefix.LeftInline(LastDash);
1965 }
1966 }
1967
1968 BaseSuffix = BaseExecutableName.RightChop(BasePrefix.Len());
1969 }
1970
1972
1973 // Loading preinit/common module if it exists.
1974 // PreInit module can contain things like decryption logic for pak files and things that is project specific but needs to initialize very early
1975 // Common module is a merged binary containing all the important modules for the project
1977 {
1978#if UE_MERGED_MODULES
1979 FString::Printf(TEXT("%s-Common%s.%s"), *PathPrefix, *BaseSuffix, FPlatformProcess::GetModuleExtension()),
1981#else
1982 FString::Printf(TEXT("%s-%sPreInit%s.%s"), *PathPrefix, FApp::GetProjectName(), *BaseSuffix, FPlatformProcess::GetModuleExtension()),
1984#endif
1985 };
1986
1987 // UE-230629: On mac UnrealLightmass this would cause assert on main thread
1988#if PLATFORM_MAC
1989 if (![NSThread isMainThread])
1990 {
1991#endif
1993#if PLATFORM_MAC
1994 }
1995#endif
1996
1997 for (const FString& FileName : FileNames)
1998 {
2001 {
2003 break;
2004 }
2005 }
2006#endif
2007 }
2008
2009 // Output devices.
2010 {
2011 SCOPED_BOOT_TIMING("Init Output Devices");
2012#if WITH_APPLICATION_CORE
2015#else
2018#endif
2019
2020 {
2021 SCOPED_NAMED_EVENT_TEXT("FCoreDelegates::OnOutputDevicesInit", CoreDelegatesColor);
2023 }
2024 }
2025
2026 // Avoiding potential exploits by not exposing command line overrides in the shipping games.
2027#if !UE_BUILD_SHIPPING
2028 {
2029 SCOPED_BOOT_TIMING("Command Line Adjustments");
2030
2032 if (FPaths::ProjectDir().Len() > 0)
2033 {
2034 // Pass EngineIntermediateDir as GeneratedConfigDir of FPaths::GeneratedConfigDir() so that saved directory is not cached before -saveddir argument can be added
2036 /*bIsBaseIniName=*/ false,
2037 /*Platform=*/ nullptr,
2038 /*bForceReload=*/ false,
2039 /*bWriteDestIni=*/ false,
2040 /*bAllowGeneratedIniWhenCooked=*/ true,
2041 /*GeneratedConfigDir=*/ *FPaths::EngineIntermediateDir());
2042 }
2043
2046
2047 bool bChanged = false;
2048 for(;;)
2049 {
2050 bool bExpandedAliases = false;
2052
2053 bool bExpandedCmdLineFile = false;
2055
2057 {
2058 bChanged = true;
2059 }
2060 else
2061 {
2062 break;
2063 }
2064 }
2065
2066 if (bChanged)
2067 {
2068 CmdLine = FCommandLine::Get();
2069 }
2070 }
2071#endif
2072
2073#if USE_IO_DISPATCHER
2074 if (FIoStatus Status = FIoDispatcher::Initialize(); !Status.IsOk())
2075 {
2076 UE_LOG(LogInit, Error, TEXT("Failed to initialize I/O dispatcher: '%s'"), *Status.ToString());
2077 return 1;
2078 }
2079#endif
2080
2081 {
2082 SCOPED_BOOT_TIMING("BeginPreInitTextLocalization");
2084 }
2085
2086#if WITH_ENGINE
2087 {
2088 SCOPED_BOOT_TIMING("PreInitShaderLibrary");
2090 }
2091#endif // WITH_ENGINE
2092
2093 // allow the command line to override the platform file singleton
2094 bool bFileOverrideFound = false;
2095 {
2096 SCOPED_BOOT_TIMING("LaunchCheckForFileOverride");
2097 if (LaunchCheckForFileOverride(CmdLine, bFileOverrideFound) == false)
2098 {
2099 // if it failed, we cannot continue
2100 return 1;
2101 }
2102 }
2103
2104 //
2105#if PLATFORM_DESKTOP && !IS_MONOLITHIC
2106 {
2107 SCOPED_BOOT_TIMING("AddExtraBinarySearchPaths");
2109 }
2110#endif
2111
2112 // Initialize file manager
2113 {
2114 SCOPED_BOOT_TIMING("IFileManager::Get().ProcessCommandLineOptions");
2116 }
2117
2118#if WITH_COREUOBJECT
2119 {
2120 SCOPED_BOOT_TIMING("InitializeNewAsyncIO");
2122 }
2123#endif
2124
2126
2128 {
2129 // If we launched without a project file, but with a game name that is incomplete, warn about the improper use of a Game suffix
2131 {
2132 // We did not find a non-suffixed folder and we DID find the suffixed one.
2133 // The engine MUST be launched with <GameName>Game.
2135 FMessageDialog::Open(EAppMsgType::Ok, FText::Format(LOCTEXT("RequiresGamePrefix", "Error: UnrealEditor does not append 'Game' to the passed in game name.\nYou must use the full name.\nYou specified '{0}', use '{0}Game'."), GameNameText));
2136 return 1;
2137 }
2138 }
2139
2140 // remember thread id of the main thread
2143
2147
2148 // These bools are the mode selector and are mutually exclusive. This function selects the mode by calling one of the
2149 // SetIsRunningAs* lambdas, which it does based on commandline and configuration considerations in a specific order.
2150 // TODO: Convert these bools to an enum since they are mutually exclusive.
2151 bool bHasCommandletToken = false;
2152 bool bHasEditorToken = false;
2153 bool bIsRunningAsDedicatedServer = false;
2154 bool bIsRegularClient = false;
2155
2156 FString TokenToForward;
2157
2158 // these tokens are use later to restore a single commandline string, so keep a version that has quotes around tokens,
2159 // in case there are spaces in a token which will break parsing that single string
2160 TArray<FString> TokenArray = TokenizeCommandline(CmdLine, false);
2161 TArray<FString> QuotedTokenArray = TokenizeCommandline(CmdLine, true);
2162
2164 FString GameString = ExtractGameStringArgument(TokenArray, QuotedTokenArray, GameStringType);
2165
2166 auto IsModeSelected = [&bHasCommandletToken, &bHasEditorToken, &bIsRegularClient, &bIsRunningAsDedicatedServer]()
2167 {
2168 return bHasCommandletToken || bHasEditorToken || bIsRegularClient || bIsRunningAsDedicatedServer;
2169 };
2170#if UE_EDITOR || WITH_ENGINE || WITH_EDITOR
2171 FString CommandletCommandLine;
2172 auto SetIsRunningAsCommandlet = [&CommandletCommandLine, &QuotedTokenArray,
2173 &bHasCommandletToken, &bIsRunningAsDedicatedServer, &bHasEditorToken, &bIsRegularClient, &IsModeSelected, &TokenToForward]
2175 {
2176 checkf(!IsModeSelected(), TEXT("SetIsRunningAsCommandlet should not be called after mode has been selected."));
2177 bHasCommandletToken = true;
2178
2180
2181 GIsClient = true;
2182 GIsServer = true;
2183#if WITH_EDITORONLY_DATA
2184 GIsEditor = true;
2185#endif
2186#if STATS
2187 // Leave the stats enabled.
2189 {
2190 FThreadStats::PrimaryDisableForever();
2191 }
2192#endif
2193
2194 CommandletCommandLine = FString::Join(QuotedTokenArray, TEXT(" "));
2195#if WITH_EDITOR
2196 if (CommandletName == TEXTVIEW("cookcommandlet") || FParse::Param(FCommandLine::Get(), TEXT("RunAsCookCommandlet")))
2197 {
2199 UE::Cook::InitializeCookGlobals();
2201 }
2202#endif
2203#if WITH_ENGINE
2205#endif
2206 // Allow commandlet rendering and/or audio based on command line switch (too early to let the commandlet itself override this).
2209 };
2210#endif // UE_EDITOR || WITH_ENGINE || WITH_EDITOR
2211 auto SetIsRunningAsRegularClient = [&IsModeSelected, &bIsRegularClient, &TokenArray, &TokenToForward]()
2212 {
2213 checkf(!IsModeSelected(), TEXT("SetIsRunningAsRegularClient should not be called after mode has been selected."));
2214 bIsRegularClient = true;
2215
2216 // Take the first non-switch command-line parameter (i.e. one not starting with a dash) and remember
2217 // it to check later as it could be a mistyped commandlet (short name).
2218 const FString* NonSwitchParam = TokenArray.FindByPredicate(
2219 [](const FString& Token)
2220 {
2221 return Token[0] != TCHAR('-');
2222 }
2223 );
2224
2225 if (NonSwitchParam)
2226 {
2228 }
2229
2230 GIsClient = true;
2231 GIsServer = false;
2232#if WITH_EDITORONLY_DATA
2233 GIsEditor = false;
2234#endif
2235#if WITH_ENGINE
2236 checkf(!PRIVATE_GIsRunningCommandlet, TEXT("It should not be possible for PRIVATE_GIsRunningCommandlet to have been set when calling SetIsRunningAsRegularClient"));
2237#endif
2238 };
2240 {
2241 checkf(!IsModeSelected(), TEXT("SetIsRunningAsDedicatedServer should not be called after mode has been selected."));
2243
2244 GIsClient = false;
2245 GIsServer = true;
2246#if WITH_EDITORONLY_DATA
2247 GIsEditor = false;
2248#endif
2249#if WITH_ENGINE
2250 checkf(!PRIVATE_GIsRunningCommandlet, TEXT("It should not be possible for PRIVATE_GIsRunningCommandlet to have been set when calling SetIsRunningAsDedicatedServer"));
2251#endif
2252 };
2253#if WITH_EDITORONLY_DATA
2254 auto SetIsRunningAsEditor = [&IsModeSelected, &bHasEditorToken]()
2255 {
2256 checkf(!IsModeSelected(), TEXT("SetIsRunningAsEditor should not be called after mode has been selected."));
2257 bHasEditorToken = true;
2258
2259 GIsClient = true;
2260 GIsServer = true;
2261 GIsEditor = true;
2262#if WITH_ENGINE
2263 checkf(!PRIVATE_GIsRunningCommandlet, TEXT("It should not be possible for PRIVATE_GIsRunningCommandlet to have been set when calling SetIsRunningAsEditor"));
2264#endif
2265 };
2266#endif
2267
2269 {
2271 }
2272
2273#if UE_EDITOR || WITH_ENGINE || WITH_EDITOR
2276 UCommandlet::ParseCommandLine(CmdLine, NonSwitchTokens, Switches);
2277 if (!IsModeSelected())
2278 {
2279 for (const FString& ParsedToken : NonSwitchTokens)
2280 {
2281 if (ParsedToken.EndsWith(TEXT("Commandlet")))
2282 {
2283 SetIsRunningAsCommandlet(ParsedToken.TrimStartAndEnd());
2284 break;
2285 }
2286 }
2288 {
2289 for (const FString& ParsedSwitch : Switches)
2290 {
2291 if (ParsedSwitch.StartsWith(TEXT("RUN=")))
2292 {
2293 FString LocalToken = ParsedSwitch.RightChop(4);
2294 LocalToken.TrimStartAndEndInline();
2295 if (!LocalToken.EndsWith(TEXT("Commandlet")))
2296 {
2297 LocalToken += TEXT("Commandlet");
2298 }
2300 break;
2301 }
2302 }
2303 }
2304 }
2305#endif // UE_EDITOR || WITH_ENGINE || WITH_EDITOR
2306#if WITH_EDITOR
2308 if (FParse::Value(CmdLine, TEXT("-MultiprocessId="), MultiprocessId))
2309 {
2311 }
2312#endif
2313
2314
2315 // In the commandlet case, we have set the Token to something other than the first token from commandline.
2316 // In all other cases we should check for the first token being the Project Specifier
2318 {
2320 {
2321 // Set a new command-line that doesn't include the game name as the first argument.
2322 FCommandLine::Set(*FString::Join(QuotedTokenArray, TEXT(" ")));
2323
2324 // Remove spurious project file tokens (which can happen on some platforms that combine commandlines).
2325 // This handles extra .uprojects, but if you run with MyGame MyGame, we can't tell if the second MyGame is a map or not.
2326 TokenArray.RemoveAll(
2327 [](const FString& Token)
2328 {
2329 return Token[0] != TCHAR('-') && FPaths::GetExtension(Token) == FProjectDescriptor::GetExtension();
2330 }
2331 );
2332
2334 {
2335 // Convert it to relative if possible...
2338 {
2340 }
2341 }
2342 }
2343
2344#if UE_EDITOR
2345 // Handle the first token being '-game' or '-server'
2346 if (!TokenArray.IsEmpty())
2347 {
2348 if (TokenArray[0] == TEXT("-GAME") || TokenArray[0] == TEXT("-SERVER"))
2349 {
2350 // This isn't necessarily pretty, but many requests have been made to allow
2351 // UnrealEditor.exe <GAMENAME> -game <map>
2352 // or
2353 // UnrealEditor.exe <GAMENAME> -game 127.0.0.0
2354 // We don't want to remove the -game from the commandline just yet in case
2355 // we need it for something later. So, just move it to the end for now...
2356 FString LocalToken = TokenArray[0];
2357 TokenArray.Add(LocalToken);
2358 TokenArray.RemoveAt(0);
2360 QuotedTokenArray.RemoveAt(0);
2361
2362 FCommandLine::Set(*FString::Join(QuotedTokenArray, TEXT(" ")));
2363 }
2364 }
2365#endif
2366 }
2367
2368 // If we have no Commandlet or -server, test if we are running as the editor, and set the GIsEditor/GIsClient/GIsServer flags if so.
2369 // Do this early (and certainly before AppInit) so plugin-consumed library code can know (they wouldn't otherwise)
2370 // Things like the config system behave differently based on these globals, and we aren't the editor by default.
2371 if (!IsModeSelected())
2372 {
2373#if UE_EDITOR
2374 if (!Switches.Contains(TEXT("GAME")))
2375 {
2377 }
2378#elif WITH_ENGINE && WITH_EDITOR && WITH_EDITORONLY_DATA
2379 // If a non-editor target build w/ WITH_EDITOR and WITH_EDITORONLY_DATA, use the old token check...
2380 //@todo. Is this something we need to support?
2381 if (TokenArray.Contains(TEXT("EDITOR")))
2382 {
2384 }
2385#endif
2386 // Game, server and non-engine programs never run as the editor
2387 }
2388
2389#if UE_EDITOR
2390 // In the UE_EDITOR configuration we now know enough to finish the mode decision and decide between commandlet or client
2391 // In other configurations we still may need to check the Token for whether it is a commandlet and we make the decision below
2392 if (!IsModeSelected())
2393 {
2395 }
2396
2397 if (bHasEditorToken && GIsGameAgnosticExe)
2398 {
2399 // If we launched the editor IDE (e.g. not commandlet or -game) without a game name or project name, try to load the most recently loaded project file.
2400 // We can not do this if we are using a FilePlatform override since the game directory may already be established.
2401 const bool bIsBuildMachine = FParse::Param(FCommandLine::Get(), TEXT("BUILDMACHINE"));
2404 {
2406 }
2407 }
2408#endif
2409
2410#if !UE_BUILD_SHIPPING
2411 // Benchmarking.
2413#else
2414 FApp::SetBenchmarking(false);
2415#endif // !UE_BUILD_SHIPPING
2416
2417#if WITH_FIXED_TIME_STEP_SUPPORT
2418 // "-Deterministic" is a shortcut for "-UseFixedTimeStep -FixedSeed"
2419 bool bDeterministic = FParse::Param(FCommandLine::Get(), TEXT("Deterministic"));
2420
2421 FApp::SetUseFixedTimeStep(bDeterministic || FParse::Param(FCommandLine::Get(), TEXT("UseFixedTimeStep")));
2422
2423 FApp::bUseFixedSeed = bDeterministic || FApp::IsBenchmarking() || FParse::Param(FCommandLine::Get(), TEXT("FixedSeed"));
2424#endif
2425
2426 // Initialize random number generator.
2427 {
2428 uint32 Seed1 = 0;
2429 uint32 Seed2 = 0;
2430
2432 {
2435 }
2436
2437 FMath::RandInit(Seed1);
2438 FMath::SRandInit(Seed2);
2439
2440 UE_LOG(LogInit, Verbose, TEXT("RandInit(%d) SRandInit(%d)."), Seed1, Seed2);
2441 }
2442
2443#if !IS_PROGRAM
2445 {
2446 // If we are using a non-agnostic exe where a name was specified but we did not specify a project path. Assemble one based on the game name.
2449 }
2450#endif
2451
2452 // Initialize platform file with knowledge of the project file path before fixing the casing
2454
2455 {
2456 SCOPED_BOOT_TIMING("PlatformFileChainElement->InitializeAfterProjectFilePath");
2458 {
2459 PlatformFileChainElement->InitializeAfterProjectFilePath();
2460 }
2461 }
2462
2463#if !IS_PROGRAM
2464 // Now let the platform file fix the project file path case before we attempt to fix the game name
2466#endif
2467
2468 // Now verify the project file if we have one
2470#if IS_PROGRAM
2471 // Programs don't need uproject files to exist, but some do specify them and if they exist we should load them
2473#endif
2474 )
2475 {
2476 SCOPED_BOOT_TIMING("IProjectManager::Get().LoadProjectFile");
2477
2478 if (!IProjectManager::Get().LoadProjectFile(FPaths::GetProjectFilePath()))
2479 {
2480 // The project file was invalid or saved with a newer version of the engine. Exit.
2481 UE_LOG(LogInit, Warning, TEXT("Could not find a valid project file, the engine will exit now."));
2482 return 1;
2483 }
2484
2485 if (IProjectManager::Get().IsEnterpriseProject() && FPaths::DirectoryExists(FPaths::EnterpriseDir()))
2486 {
2487 // Add the enterprise binaries directory if we're an enterprise project
2489 }
2490
2491 if (!ReplacementProjectModuleName.IsEmpty())
2492 {
2493 IProjectManager::Get().SubstituteModule(OriginalProjectModuleName, ReplacementProjectModuleName);
2494 }
2495 }
2496
2497#if !IS_PROGRAM
2499 {
2500 // Tell the module manager what the game binaries folder is
2504
2506 }
2507#endif
2508
2509#if WITH_ENGINE
2510 // Add the default engine shader dir
2512
2513 // Add <PROJECT>/Shaders/ folder to virtual shader include directories
2514 const FString ProjectShaderPath = FPaths::Combine(FPaths::ProjectDir(), TEXT("Shaders"));
2516 {
2518 }
2519
2520#if WITH_EDITOR
2521 {
2523 FString ProjectIntermediateDir = FPaths::ProjectIntermediateDir();
2524 bool bCreateIntermediateSuccess = PlatformFile.CreateDirectoryTree(*ProjectIntermediateDir);
2526 {
2527 UE_LOG(LogInit, Fatal, TEXT("Failed to create Intermediate directory '%s'."), *ProjectIntermediateDir);
2528 }
2529
2530 FString AutogenAbsolutePath = FPaths::ConvertRelativePathToFull(ProjectIntermediateDir / TEXT("ShaderAutogen"));
2533 {
2534 UE_LOG(LogInit, Fatal, TEXT("Failed to create Intermediate/ShaderAutogen/ directory '%s'. Make sure Intermediate exists."), *AutogenAbsolutePath);
2535 }
2536
2538 }
2539#endif //WITH_EDITOR
2540#endif //WITH_ENGINE
2541
2542 // Some programs might not use the taskgraph or thread pool
2544 // If STATS is defined (via FORCE_USE_STATS or other), we have to call FTaskGraphInterface::Startup()
2545#if IS_PROGRAM && !STATS
2547#endif
2549 {
2550 // initialize task graph sub-system with potential multiple threads
2551 SCOPED_BOOT_TIMING("FTaskGraphInterface::Startup");
2554 }
2555
2556#if WITH_EDITOR && PLATFORM_WINDOWS
2558#endif
2559
2561 {
2562 SCOPED_BOOT_TIMING("Init FQueuedThreadPool's");
2563
2564 int32 StackSize = 128 * 1024;
2565 // GConfig is not initialized yet, the only solution for now is to hardcode desired values
2566 // GConfig->GetInt(TEXT("Core.System"), TEXT("PoolThreadStackSize"), StackSize, GEngineIni);
2567
2568 bool bForceEditorStackSize = false;
2569#if WITH_EDITOR
2570 bForceEditorStackSize = true;
2571#endif
2572
2573 if (bHasEditorToken || bForceEditorStackSize)
2574 {
2575 StackSize = 1024 * 1024;
2576 }
2577
2578#if WITH_EDITOR
2579 {
2581 // when we are in the editor we like to do things like build lighting and such
2582 // this thread pool can be used for those purposes
2584
2585 // we are only going to give dedicated servers one pool thread
2586 if (FPlatformProperties::IsServerOnly())
2587 {
2589 }
2590
2591 // GThreadPool will schedule on the LargeThreadPool but limit max concurrency to the given number.
2593 }
2594#else
2595 {
2597 }
2598#endif
2599 {
2602 if (FPlatformProperties::IsServerOnly())
2603 {
2605 }
2606
2607 verify(GBackgroundPriorityThreadPool->Create(NumThreadsInThreadPool, StackSize, TPri_Lowest, TEXT("BackgroundThreadPool")));
2608 }
2609 }
2610
2611 // this can start using TaskGraph and ThreadPool so they must be created before
2613
2614#if !IS_PROGRAM && !IS_MONOLITHIC
2615 if (FApp::HasProjectName() && FCString::Strcmp(CurrentPlatformFile->GetName(), TEXT("PakFile")) == 0)
2616 {
2619 }
2620#endif
2621
2623#if STATS
2624 FThreadStats::StartThread();
2625#endif
2626
2628
2630
2631 // Load Core modules required for everything else to work (needs to be loaded before InitializeRenderingCVarsCaching)
2632 {
2633 SCOPED_BOOT_TIMING("LoadCoreModules");
2634 if (!LoadCoreModules())
2635 {
2636 UE_LOG(LogInit, Error, TEXT("Failed to load Core modules."));
2637 return 1;
2638 }
2639 }
2640
2641 const bool bDumpEarlyConfigReads = FParse::Param(FCommandLine::Get(), TEXT("DumpEarlyConfigReads"));
2642 const bool bDumpEarlyPakFileReads = FParse::Param(FCommandLine::Get(), TEXT("DumpEarlyPakFileReads"));
2643 const bool bForceQuitAfterEarlyReads = FParse::Param(FCommandLine::Get(), TEXT("ForceQuitAfterEarlyReads"));
2644
2645 // Overly verbose to avoid a dumb static analysis warning
2646#if WITH_CONFIG_PATCHING
2647 constexpr bool bWithConfigPatching = true;
2648#else
2649 constexpr bool bWithConfigPatching = false;
2650#endif
2651
2652 if (bDumpEarlyConfigReads)
2653 {
2655 }
2656
2657 if (bDumpEarlyPakFileReads)
2658 {
2660 }
2661
2662 if(bWithConfigPatching)
2663 {
2664 UE_LOG(LogInit, Verbose, TEXT("Begin recording CVar changes for config patching."));
2665
2667 }
2668
2669#if WITH_ENGINE
2672#endif
2673
2674#if WITH_EDITOR
2675 // If we're running as a game or server but don't have a project, inform the user and exit.
2676 if (bHasEditorToken == false && bHasCommandletToken == false)
2677 {
2679 {
2680 //@todo this is too early to localize
2681 FMessageDialog::Open(EAppMsgType::Ok, NSLOCTEXT("Engine", "UERequiresProjectFiles", "Unreal Engine games require a project file as the first parameter."));
2682 return 1;
2683 }
2684 }
2685
2686#endif //WITH_EDITOR
2687
2688#if WITH_APPLICATION_CORE
2689 // Get a pointer to the log output device
2691#endif
2692
2693 // init Oodle here
2695
2696 {
2697 SCOPED_BOOT_TIMING("LoadPreInitModules");
2699 }
2700
2701#if WITH_ENGINE && CSV_PROFILER
2702 FCsvProfiler::Get()->Init();
2703#endif
2704
2705#if WITH_ENGINE
2706 AppLifetimeEventCapture::Init();
2707
2708 if (bHasEditorToken)
2709 {
2710#if WITH_EDITOR
2712#else //WITH_EDITOR
2713 FMessageDialog::Open(EAppMsgType::Ok, NSLOCTEXT("Engine", "EditorNotSupported", "Editor not supported in this mode."));
2714 FPlatformMisc::RequestExit(false, TEXT("FEngineLoop::PreInitPreStartupScreen.bHasEditorToken"));
2715 return 1;
2716#endif //WITH_EDITOR
2717 }
2718#endif // WITH_ENGINE
2719
2720#if WITH_ENGINE && FRAMEPRO_ENABLED
2721 FFrameProProfiler::Initialize();
2722#endif // FRAMEPRO_ENABLED
2723
2724 // Start the application
2725 {
2726 SCOPED_BOOT_TIMING("AppInit");
2727 if (!AppInit())
2728 {
2729 return 1;
2730 }
2731 }
2732
2733 // Try to start the dedicated primary thread now that the command line is available,
2734 // and the default output devices have been created. Initializing earlier will cause
2735 // logs to be missed by the default output devices.
2736 if (!FParse::Param(FCommandLine::Get(), TEXT("NoLogThread")))
2737 {
2738 GLog->TryStartDedicatedPrimaryThread();
2739 }
2740
2742 {
2743 {
2744 SCOPED_BOOT_TIMING("GIOThreadPool->Create");
2747 if (FPlatformProperties::IsServerOnly())
2748 {
2750 }
2752 }
2753 }
2754
2756
2757#if WITH_ENGINE
2758 {
2759 SCOPED_BOOT_TIMING("System settings and cvar init");
2760 // Initialize system settings before anyone tries to use it...
2761 GSystemSettings.Initialize(bHasEditorToken);
2762
2763 // Apply renderer settings from console variables stored in the INI.
2765 UE::ConfigUtilities::ApplyCVarSettingsFromIni(TEXT("/Script/Engine.RendererOverrideSettings"), *GEngineIni, ECVF_SetByProjectSetting);
2767 UE::ConfigUtilities::ApplyCVarSettingsFromIni(TEXT("/Script/Engine.GarbageCollectionSettings"), *GEngineIni, ECVF_SetByProjectSetting);
2769#if WITH_EDITOR
2771#endif // WITH_EDITOR
2772
2773#if !UE_SERVER
2775 {
2777 {
2778 // Note: It is critical that resolution settings are loaded before the movie starts playing so that the window size and fullscreen state is known
2780 }
2781 }
2782#endif // !UE_SERVER
2783 }
2784 {
2785 {
2786 SCOPED_BOOT_TIMING("InitScalabilitySystem");
2787 // Init scalability system and defaults
2789 }
2790
2791#if UE_WITH_CONSTINIT_UOBJECT
2792 {
2793 SCOPED_BOOT_TIMING("ConstructCompiledInObjects Early");
2794 UE::CoreUObject::ConstructCompiledInObjects();
2795 }
2796#endif // UE_WITH_CONSTINIT_UOBJECT
2797
2798 {
2799 SCOPED_BOOT_TIMING("InitializeCVarsForActiveDeviceProfile");
2800 // Set all CVars which have been setup in the device profiles.
2801 // This may include scalability group settings which will override
2802 // the defaults set above which can then be replaced below when
2803 // the game user settings are loaded and applied.
2805 }
2806
2807 {
2808 SCOPED_BOOT_TIMING("Scalability::LoadState");
2809 // As early as possible to avoid expensive re-init of subsystems,
2810 // after SystemSettings.ini file loading so we get the right state,
2811 // before ConsoleVariables.ini so the local developer can always override.
2812 // after InitializeCVarsForActiveDeviceProfile() so the user can override platform defaults
2814 }
2815
2817 {
2818 GUseThreadedRendering = true;
2819 }
2820 }
2821#endif // WITH_ENGINE
2822
2823 {
2824 SCOPED_BOOT_TIMING("LoadConsoleVariablesFromINI");
2826 }
2827
2828 {
2829 SCOPED_BOOT_TIMING("Platform Initialization");
2831
2832 // platform specific initialization now that the SystemSettings are loaded
2834#if WITH_APPLICATION_CORE
2836#endif
2838 }
2839
2840 {
2841 SCOPED_BOOT_TIMING("AutoRTFM");
2843 }
2844
2845#if WITH_ENGINE
2846 {
2847 SCOPED_BOOT_TIMING("InitDerivedData");
2848 UE::DerivedData::IoStore::InitializeIoDispatcher();
2849 }
2850#endif // WITH_ENGINE
2851
2852#if !UE_BUILD_SHIPPING
2853 {
2855 CSV_METADATA(TEXT("ExtraDevelopmentMemoryMB"), *FString::FromInt(ExtraDevelopmentMemoryMB));
2856 }
2857#endif
2858
2859#if USE_IO_DISPATCHER
2860 {
2861 SCOPED_BOOT_TIMING("InitIoDispatcher");
2863 }
2864
2865 FModuleManager::Get().LoadModule("IoStoreOnDemandCore");
2866#if UE_WITH_IOSTOREONDEMAND
2867 FModuleManager::Get().LoadModule("IoStoreOnDemand");
2868#endif // UE_WITH_IOSTOREONDEMAND
2869
2870#endif // USE_IO_DISPATCHER
2871
2872 // Let LogConsole know what ini file it should use to save its setting on exit.
2873 // We can't use GGameIni inside log console because it's destroyed in the global
2874 // scoped pointer and at that moment GGameIni may already be gone.
2875 if (GLogConsole != nullptr)
2876 {
2878 }
2879
2880
2881#if CHECK_PUREVIRTUALS
2882 FMessageDialog::Open(EAppMsgType::Ok, NSLOCTEXT("Engine", "Error_PureVirtualsEnabled", "The game cannot run with CHECK_PUREVIRTUALS enabled. Please disable CHECK_PUREVIRTUALS and rebuild the executable."));
2883 FPlatformMisc::RequestExit(false, TEXT("FEngineLoop::PreInitPreStartupScreen.Check_PureVirtuals"));
2884#endif
2885
2887
2888 PreInitContext.SlowTaskPtr = new FScopedSlowTask(100, NSLOCTEXT("EngineLoop", "EngineLoop_Initializing", "Initializing..."));
2889 FScopedSlowTask& SlowTask = *PreInitContext.SlowTaskPtr;
2890
2891#if WITH_ENGINE
2892 // allow for game explorer processing (including parental controls) and firewalls installation
2894 {
2895 FPlatformMisc::RequestExit(false, TEXT("FEngineLoop::PreInitPreStartupScreen.CommandLineCommands"));
2896 }
2897
2898#if !UE_EDITOR
2899 // UE_EDITOR doesn't care the meaning of the token except for a few special cases (FooCommandlet, -run=, -game, -server)
2900 // But when running without UE_EDITOR, we look up the token as a class to see if it is a commandlet name prefix
2901 FString LateCommandletName;
2902 if (!IsModeSelected())
2903 {
2904 //@hack: We need to set these before calling StaticLoadClass so all required data gets loaded for the commandlets.
2907#if WITH_EDITOR
2909#endif // WITH_EDITOR
2911
2912 // Take the first non-switch command-line parameter (i.e. one not starting with a dash). We will check if it's possibly a commandlet.
2913 const FString* NonSwitchParam = TokenArray.FindByPredicate(
2914 [](const FString& Token)
2915 {
2916 return Token[0] != TCHAR('-');
2917 }
2918 );
2919
2920 bool bIsPossiblyCommandletName = NonSwitchParam != nullptr;
2922 {
2923 FString CommandletName = *NonSwitchParam;
2924
2925 if (!CommandletName.EndsWith(TEXT("Commandlet")))
2926 {
2927 CommandletName += TEXT("Commandlet");
2928 }
2929
2932 {
2933 checkf(TempCommandletClass->IsChildOf(UCommandlet::StaticClass()), TEXT("It is not valid to have a class that ends with \"Commandlet\" that is not a UCommandlet subclass."));
2934
2936 }
2937 }
2938 }
2939 if (!LateCommandletName.IsEmpty())
2940 {
2942 }
2943
2944 // In non-UE_EDITOR configuration this is the point where know enough to finish the mode decision and decide between commandlet or client
2945 if (!IsModeSelected())
2946 {
2948 }
2949#endif
2950
2951 // If std out device hasn't been initialized yet (there was no -stdout param in the command line) and
2952 // we meet all the criteria, initialize it now.
2953 if (!GScopedStdOut && !bHasEditorToken && !bIsRegularClient && !bIsRunningAsDedicatedServer)
2954 {
2955 SCOPED_BOOT_TIMING("InitializeStdOutDevice");
2956
2958 }
2959
2960#if WITH_EDITOR
2962 {
2964 FString InitErrors;
2966 {
2968 return 1;
2969 }
2970 }
2971#endif
2972
2973 {
2974 SCOPED_BOOT_TIMING("IPlatformFeaturesModule::Get()");
2975 // allow the platform to start up any features it may need
2977 }
2978
2979 {
2980 SCOPED_BOOT_TIMING("InitGamePhys");
2981 // Init physics engine before loading anything, in case we want to do things like cook during post-load.
2982 if (!InitGamePhys())
2983 {
2984 // If we failed to initialize physics we cannot continue.
2985 return 1;
2986 }
2987 }
2988
2989 {
2991
2992 // Only clean the shader working directory if we are the first instance, to avoid deleting files in use by other instances
2993 //@todo - check if any other instances are running right now
2995
2997 {
2998 SCOPED_BOOT_TIMING("FPlatformProcess::CleanShaderWorkingDirectory");
2999
3000 // get shader path, and convert it to the userdirectory
3002 {
3003 FString ShaderDir = FString(FPlatformProcess::BaseDir()) / SHaderSourceDirectoryEntry.Value;
3006
3007 // make sure we don't delete from the source directory
3008 if (ShaderDir != UserShaderDir)
3009 {
3011 }
3012 }
3013
3015 }
3016 }
3017
3018#if !UE_BUILD_SHIPPING
3020#endif
3021
3022 // InitEngineTextLocalization loads Paks, needs Oodle to be setup before here
3024
3025 bool bForceEnableHighDPI = false;
3026#if WITH_EDITOR
3027 bForceEnableHighDPI = FPIEPreviewDeviceModule::IsRequestingPreviewDevice();
3028#endif
3029
3030 // This must be called before any window (including the splash screen is created
3032
3034
3036 {
3037 bool bUseThreadedAudio = false;
3038 if (!GIsEditor)
3039 {
3040 GConfig->GetBool(TEXT("Audio"), TEXT("UseAudioThread"), bUseThreadedAudio, GEngineIni);
3041 }
3042 FAudioThread::SetUseThreadedAudio(bUseThreadedAudio);
3043 }
3044
3045 // Ensure engine localization has loaded before we show the splash
3047
3048 // Are we creating a slate application?
3049 bool bSlateApplication = !IsRunningDedicatedServer() && (bIsRegularClient || bHasEditorToken);
3051 {
3053 {
3054 SCOPED_BOOT_TIMING("FPlatformSplash::Show()");
3056 }
3057
3058 // Init platform application
3059 SCOPED_BOOT_TIMING("FSlateApplication::Create()");
3061 }
3062 else
3063 {
3064 // If we're not creating the slate application there is some basic initialization
3065 // that it does that still must be done
3068 }
3069
3070 if (GIsEditor)
3071 {
3072 // The editor makes use of all cultures in its UI, so pre-load the resource data now to avoid a hitch later
3074 }
3075
3077
3078 SlowTask.EnterProgressFrame(10);
3079
3080#if USE_LOCALIZED_PACKAGE_CACHE
3082 {
3084 });
3085#endif // USE_LOCALIZED_PACKAGE_CACHE
3086
3087 {
3088 SCOPED_BOOT_TIMING("FShaderParametersMetadataRegistration::CommitAll()");
3090 }
3091
3092 {
3093 SCOPED_BOOT_TIMING("FShaderTypeRegistration::CommitAll()");
3095 }
3096
3097 {
3098 SCOPED_BOOT_TIMING("FUniformBufferStruct::InitializeStructs()");
3100 }
3101
3102 {
3103 SCOPED_BOOT_TIMING("PreInitHMDDevice()");
3105 }
3106
3108 {
3109 SCOPED_BOOT_TIMING("RHIInit");
3110 // Initialize the RHI.
3111 RHIInit(bHasEditorToken);
3112 }
3113
3114 {
3115 SCOPED_BOOT_TIMING("PipelineStateCacheInit");
3117 }
3118
3119 {
3120 UE_SCOPED_ENGINE_ACTIVITY(TEXT("Initializing Render Settings"));
3121 SCOPED_BOOT_TIMING("RenderUtilsInit");
3122 // One-time initialization of global variables based on engine configuration.
3124 }
3125
3126 {
3127 bool bUseCodeLibrary = FPlatformProperties::RequiresCookedData() || GAllowCookedDataInEditorBuilds;
3128 if (bUseCodeLibrary)
3129 {
3130 {
3131 SCOPED_BOOT_TIMING("FShaderCodeLibrary::InitForRuntime");
3132 // Will open material shader code storage if project was packaged with it
3133 // This only opens the Global shader library, which is always in the content dir.
3135 }
3136
3137 #if !UE_EDITOR
3138 // Cooked data only - but also requires the code library - game only
3139 if (FPlatformProperties::RequiresCookedData())
3140 {
3141 SCOPED_BOOT_TIMING("FShaderPipelineCache::Initialize");
3142 // Initialize the pipeline cache system. Opening is deferred until the manual call to
3143 // OpenPipelineFileCache below, after content pak's ShaderCodeLibraries are loaded.
3145 }
3146 #endif
3147 }
3148 }
3149
3150#if WITH_ODSC
3153 {
3154 GODSCManager = new FODSCManager();
3155 }
3156#endif
3157
3158 if (!FPlatformProperties::RequiresCookedData())
3159 {
3160#if WITH_EDITORONLY_DATA
3161 {
3162 // Ensure that DDC is initialized from the game thread.
3163 UE_SCOPED_ENGINE_ACTIVITY(TEXT("Initializing Derived Data Cache"));
3164 SCOPED_BOOT_TIMING("InitDerivedData");
3165 UE::DerivedData::GetCache();
3166 UE::DerivedData::GetBuild();
3168 }
3169#endif
3170
3171#if WITH_EDITOR
3173 {
3174 // Explicit initialization of the virtualization system, before slate has initialized and we cannot show error dialogs
3176 }
3177#endif //WITH_EDITOR
3178
3181
3184
3186 {
3189
3192
3193 // Shader hash cache is required only for shader compilation.
3195 }
3196 else
3197 {
3198 // create a manager, but it won't do anything internally
3200 }
3201 }
3202
3203 {
3205
3206 bool bSupportCookedEditor = false;
3207 GConfig->GetBool(TEXT("CookedEditorSettings"), TEXT("bSupportCookedEditor"), bSupportCookedEditor, GGameIni);
3209
3212
3214 }
3215
3216 {
3217 SCOPED_BOOT_TIMING("GetRendererModule");
3218 // Cache the renderer module in the main thread so that we can safely retrieve it later from the rendering thread.
3220 }
3221
3222 {
3224 {
3225 UE_SCOPED_ENGINE_ACTIVITY(TEXT("Initializing Shader Types"));
3226 SCOPED_BOOT_TIMING("InitializeShaderTypes");
3227
3228#if WITH_EDITOR
3229 // Explicitly generate AutogenShaderHeaders.ush prior to shader type initialization
3230 // (since that process will load and cache this header as a sideeffect)
3232#endif
3233
3234 // Initialize shader types before loading any shaders
3236 }
3237
3239
3240 SlowTask.EnterProgressFrame(25, LOCTEXT("CompileGlobalShaderMap", "Compiling Global Shaders..."));
3241
3242 // Load the global shaders
3244 {
3245 LLM_SCOPE(ELLMTag::Shaders);
3246 SCOPED_BOOT_TIMING("CompileGlobalShaderMap");
3249 {
3250 // This means we can't continue without the global shader map.
3251 return 1;
3252 }
3253 }
3254
3255 SlowTask.EnterProgressFrame(5);
3256
3257 {
3258 SCOPED_BOOT_TIMING("CreateMoviePlayer");
3260 }
3261
3263 {
3264 SCOPED_BOOT_TIMING("FPreLoadScreenManager::Create");
3267 }
3268
3269 // If platforms support early movie playback we have to start the rendering thread much earlier
3270#if PLATFORM_SUPPORTS_EARLY_MOVIE_PLAYBACK
3271 {
3272 SCOPED_BOOT_TIMING("PostInitRHI");
3273 PostInitRHI();
3274 }
3275
3277#endif
3278
3280
3281 {
3282#if !UE_SERVER// && !UE_EDITOR
3284 {
3286 FModuleManager::Get().LoadModuleChecked<ISlateNullRendererModule>("SlateNullRenderer").CreateSlateNullRenderer() :
3287 FModuleManager::Get().GetModuleChecked<ISlateRHIRendererModule>("SlateRHIRenderer").CreateSlateRHIRenderer();
3289
3290 {
3291 SCOPED_BOOT_TIMING("CurrentSlateApp.InitializeRenderer");
3292 // If Slate is being used, initialize the renderer after RHIInit
3294 CurrentSlateApp.InitializeRenderer(SlateRendererSharedRef);
3295 }
3296
3297 {
3298 SCOPED_BOOT_TIMING("FEngineFontServices::Create");
3299 // Create the engine font services now that the Slate renderer is ready
3301 }
3302
3303 {
3304 SCOPED_BOOT_TIMING("LoadModulesForProject(ELoadingPhase::PostSplashScreen)");
3305 // Load up all modules that need to hook into the custom splash screen
3306 if (!IProjectManager::Get().LoadModulesForProject(ELoadingPhase::PostSplashScreen) || !IPluginManager::Get().LoadModulesForEnabledPlugins(ELoadingPhase::PostSplashScreen))
3307 {
3308 return 1;
3309 }
3310 }
3311
3312 {
3313 SCOPED_BOOT_TIMING("PlayFirstPreLoadScreen");
3314
3316 {
3317 {
3318 SCOPED_BOOT_TIMING("PlayFirstPreLoadScreen - FPreLoadScreenManager::Get()->Initialize");
3319 // initialize and present custom splash screen
3321 }
3322
3323 if (FPreLoadScreenManager::Get()->HasRegisteredPreLoadScreenType(EPreLoadScreenTypes::CustomSplashScreen))
3324 {
3326 }
3327 }
3328 }
3329
3330 PreInitContext.SlateRenderer = SlateRenderer;
3331 }
3332 else
3333#endif // !UE_SERVER
3334 {
3335 {
3336 SCOPED_BOOT_TIMING("LoadModulesForProject(ELoadingPhase::PostSplashScreen)");
3337 // Load up all modules that need to hook into the custom splash screen
3338 if (!IProjectManager::Get().LoadModulesForProject(ELoadingPhase::PostSplashScreen) || !IPluginManager::Get().LoadModulesForEnabledPlugins(ELoadingPhase::PostSplashScreen))
3339 {
3340 return 1;
3341 }
3342 }
3343 }
3344 }
3345 }
3346#endif // WITH_ENGINE
3347
3348 // Save PreInitContext
3349 PreInitContext.bDumpEarlyConfigReads = bDumpEarlyConfigReads;
3350 PreInitContext.bDumpEarlyPakFileReads = bDumpEarlyPakFileReads;
3351 PreInitContext.bForceQuitAfterEarlyReads = bForceQuitAfterEarlyReads;
3352 PreInitContext.bWithConfigPatching = bWithConfigPatching;
3353 PreInitContext.bHasEditorToken = bHasEditorToken;
3354#if WITH_ENGINE
3355 PreInitContext.bIsRegularClient = bIsRegularClient;
3356#endif // WITH_ENGINE
3357 PreInitContext.bIsPossiblyUnrecognizedCommandlet = bIsRegularClient && TokenToForward.Len() && !TokenToForward.Contains(TEXT("-"));
3359 PreInitContext.bTokenDoesNotHaveDash = PreInitContext.bIsPossiblyUnrecognizedCommandlet;
3361 PreInitContext.Token = TokenToForward;
3362#if UE_EDITOR || WITH_ENGINE
3363 PreInitContext.CommandletCommandLine = CommandletCommandLine;
3364#endif // UE_EDITOR || WITH_ENGINE
3365
3366#if WITH_COREUOBJECT
3367#if (WITH_VERSE_VM || defined(__INTELLISENSE__))
3368 Verse::VerseVM::Startup();
3369#else
3370 verse::FExecutionContext::Create();
3371#endif
3372#endif
3373
3374 return 0;
3375}
3376
3378{
3379 bool bEnsureOnError = false;
3380 GConfig->GetBool(TEXT("Core.System"), TEXT("EnsureCommandletOnError"), bEnsureOnError, GEngineIni);
3381 if (bEnsureOnError)
3382 {
3383 ensureMsgf(InNumErrors == 0, TEXT("Commandlet generated %d errors!"), InNumErrors);
3384 }
3385}
3386
3388{
3390 SCOPED_BOOT_TIMING("FEngineLoop::PreInitPostStartupScreen");
3391 LLM_SCOPE(ELLMTag::EnginePreInitMemory);
3392
3394 {
3395 return 0;
3396 }
3397
3398 extern bool GIsConsoleExecutable;
3399#if PLATFORM_WINDOWS
3400 /*
3401 Note - ImageNtHeader must be called after DbgHelp is initialized.Failure to wait before initialization will cause calls to
3402 SymFromAddr for monolithic exes to fail. This results in callstacks not being written to the log.
3403 From discussion with Microsoft it is unclear when this time is and could be related to large pdbs. At this time here is an appropriate spot.
3404 */
3406 {
3407 GIsConsoleExecutable = (NtHeaders->OptionalHeader.Subsystem == IMAGE_SUBSYSTEM_WINDOWS_CUI);
3408 }
3409 else
3410 {
3412 }
3413#endif // PLATFORM_WINDOWS
3414
3416
3417 // Restore PreInitContext
3418 bool bDumpEarlyConfigReads = PreInitContext.bDumpEarlyConfigReads;
3419 bool bDumpEarlyPakFileReads = PreInitContext.bDumpEarlyPakFileReads;
3420 bool bForceQuitAfterEarlyReads = PreInitContext.bForceQuitAfterEarlyReads;
3421 bool bWithConfigPatching = PreInitContext.bWithConfigPatching;
3422 bool bHasEditorToken = PreInitContext.bHasEditorToken;
3423#if WITH_ENGINE
3424 bool bIsRegularClient = PreInitContext.bIsRegularClient;
3425#endif // WITH_ENGINE
3426 bool bIsPossiblyUnrecognizedCommandlet = PreInitContext.bIsPossiblyUnrecognizedCommandlet;
3427 FString Token = PreInitContext.Token;
3428#if UE_EDITOR || WITH_ENGINE
3429 const TCHAR* CommandletCommandLine = *PreInitContext.CommandletCommandLine;
3430#endif // UE_EDITOR || WITH_ENGINE
3431
3432 check(PreInitContext.SlowTaskPtr);
3433 FScopedSlowTask& SlowTask = *PreInitContext.SlowTaskPtr;
3434
3435#if WITH_ENGINE
3436 {
3438
3439#if !UE_SERVER// && !UE_EDITOR
3441 {
3442 SCOPED_BOOT_TIMING("PreInitPostStartupScreen_StartupGraphics");
3443
3444 TSharedPtr<FSlateRenderer> SlateRenderer = PreInitContext.SlateRenderer;
3446
3447 {
3448 SCOPED_BOOT_TIMING("LoadModulesForProject(ELoadingPhase::PreEarlyLoadingScreen)");
3449 // Load up all modules that need to hook into the loading screen
3450 if (!IProjectManager::Get().LoadModulesForProject(ELoadingPhase::PreEarlyLoadingScreen) || !IPluginManager::Get().LoadModulesForEnabledPlugins(ELoadingPhase::PreEarlyLoadingScreen))
3451 {
3452 return 1;
3453 }
3454 }
3455
3456 if (BundleManager != nullptr && !BundleManager->IsNullInterface())
3457 {
3459 &OnStartupContentMounted, bDumpEarlyConfigReads, bDumpEarlyPakFileReads, bWithConfigPatching, bForceQuitAfterEarlyReads);
3460 }
3461 // If not using the bundle manager, config will be reloaded after ESP, see below
3462
3463 //If the PreLoadScreen is active, then we don't want to initialise the MoviePlayer from the same data.
3464 bool hasPreloadStartupMovie = false;
3465 //If true then we want the splash screen to be handled defaultly
3466 bool useDefaultSplash = true;
3467
3468 UE_SCOPED_ENGINE_ACTIVITY(TEXT("Play Preload Screen"));
3469 SCOPED_BOOT_TIMING("PlayFirstPreLoadScreen");
3470
3472 {
3473 SCOPED_BOOT_TIMING("PlayFirstPreLoadScreen - FPreLoadScreenManager::Get()->Initialize");
3474 // initialize and play our first Early PreLoad Screen if one is setup
3476
3477 //If either early/engine screen is present then the DefaultMoviePlayer should not be configured with the same data.
3481
3482 if (FPreLoadScreenManager::Get()->HasRegisteredPreLoadScreenType(EPreLoadScreenTypes::EarlyStartupScreen))
3483 {
3484 // disable the splash before playing the early startup screen
3487 {
3489 }
3490 );
3492
3493 useDefaultSplash = false;
3494 }
3495 else
3496 {
3497 useDefaultSplash = true;
3498 }
3499 }
3500
3501 //If a PreLoadScreenManager is present, then MoviePlayer should not read the same configurable data and rely on a different configuration setup.
3503 {
3504 SCOPED_BOOT_TIMING("GetMoviePlayer()->SetupLoadingScreenFromIni");
3505 // allow the movie player to load a sequence from the .inis (a PreLoadingScreen module could have already initialized a sequence, in which case
3506 // it wouldn't have anything in it's .ini file)
3508 }
3509
3510 if (IsMoviePlayerEnabled() && GetMoviePlayer()->HasEarlyStartupMovie())
3511 {
3512 SCOPED_BOOT_TIMING("EarlyStartupMovie");
3514
3515 // hide splash screen now before playing any movies
3517
3518 // only allowed to play any movies marked as early startup. These movies or widgets can have no interaction whatsoever with uobjects or engine features
3520
3521 // display the splash screen again now that early startup movies have played
3523
3524#if 0 && PAK_TRACKER// dump the files which have been accessed inside the pak file
3526 FString FileList = TEXT("All files accessed before init\n");
3527 for (const auto& PakMapFile : PakPlatformFile->GetPakMap())
3528 {
3529 FileList += PakMapFile.Key + TEXT("\n");
3530 }
3531 UE_LOG(LogInit, Display, TEXT("\n%s"), *FileList);
3532#endif
3533
3534 useDefaultSplash &= true;
3535 }
3536
3537 if (useDefaultSplash)
3538 {
3539 // no early startup screen, show the splash screen
3541 }
3542 }
3543 else
3544#endif // !UE_SERVER
3545 {
3546#if !UE_SERVER
3547 if (IsRunningCommandlet())
3548 {
3549 // Create the engine font services now that the Slate renderer is ready
3551 }
3552#endif
3553 {
3554 SCOPED_BOOT_TIMING("LoadModulesForProject(ELoadingPhase::PreEarlyLoadingScreen)");
3555 // Load up all modules that need to hook into the loading screen, even though there
3556 // is no loading screen we still need to load the modules registered in that phase.
3558 || !IPluginManager::Get().LoadModulesForEnabledPlugins(ELoadingPhase::PreEarlyLoadingScreen))
3559 {
3560 return 1;
3561 }
3562 }
3563 }
3564
3565 //Now that our EarlyStartupScreen is finished, lets take the necessary steps to mount paks, apply .ini cvars, and open the shader libraries if we installed content we expect to handle
3566 //If using a bundle manager, assume its handling all this stuff and that we don't have to do it.
3567 if (BundleManager == nullptr || BundleManager->IsNullInterface() || !BundleManager->SupportsEarlyStartupPatching())
3568 {
3569 // Mount Paks that were installed during EarlyStartupScreen
3571 {
3572 SCOPED_BOOT_TIMING("MountPaksAfterEarlyStartupScreen");
3573
3574 FString InstalledGameContentDir = FPaths::Combine(*FPaths::ProjectPersistentDownloadDir(), TEXT("InstalledContent"), FApp::GetProjectName(), TEXT("Content"), TEXT("Paks"));
3576
3580
3581 // Look for any plugins installed during EarlyStartupScreen
3584 }
3585
3586 DumpEarlyReads(bDumpEarlyConfigReads, bDumpEarlyPakFileReads, bForceQuitAfterEarlyReads);
3587
3588 //Reapply CVars after our EarlyLoadScreen
3589 if(bWithConfigPatching)
3590 {
3591 SCOPED_BOOT_TIMING("ReapplyCVarsFromIniAfterEarlyStartupScreen");
3592 HandleConfigReload(bWithConfigPatching);
3593 }
3594
3595 //Handle opening shader library after our EarlyLoadScreen
3596 {
3597 LLM_SCOPE(ELLMTag::Shaders);
3598 SCOPED_BOOT_TIMING("FShaderCodeLibrary::OpenLibrary");
3599
3600 // Open the game library which contains the material shaders.
3602 for (const FString& RootDir : FPlatformMisc::GetAdditionalRootDirectories())
3603 {
3605 }
3606
3607 // Now our shader code main library is opened, kick off the precompile, if already initialized
3609 }
3610 }
3611#if WITH_EDITOR
3613 {
3614 //Handle opening shader library after our EarlyLoadScreen
3615 {
3616 LLM_SCOPE(ELLMTag::Shaders);
3617 SCOPED_BOOT_TIMING("FShaderCodeLibrary::OpenLibrary");
3618
3619 // Open the game library which contains the material shaders.
3621 }
3622 }
3623#endif
3624
3626
3628
3629 // In order to be able to use short script package names get all script
3630 // package names from ini files and register them with FPackageName system.
3632
3633 SlowTask.EnterProgressFrame(5);
3634
3635
3636 {
3637 SCOPED_BOOT_TIMING("LoadAssetRegistryModule");
3638 UE_SCOPED_ENGINE_ACTIVITY(TEXT("Loading AssetRegistry"));
3639 // If we don't do this now and the async loading thread is active, then we will attempt to load this module from a thread
3640 FModuleManager::Get().LoadModule("AssetRegistry");
3641 }
3642#if WITH_COREUOBJECT
3643 // Initialize the PackageResourceManager, which is needed to load any (non-script) Packages. It is first used in ProcessNewlyLoadedObjects (due to the loading of asset references in Class Default Objects)
3644 // It has to be intialized after the AssetRegistryModule; the editor implementations of PackageResourceManager relies on it
3646#endif
3647#if WITH_EDITOR
3648 // Initialize the BulkDataRegistry, which registers BulkData structs loaded from Packages for later building. It uses the same lifetime as IPackageResourceManager
3649 IBulkDataRegistry::Initialize();
3650#endif
3651
3653
3654 // for any auto-registered functions that want to wait until main(), run them now
3655 // @todo loadtime: this should have phases, so caller can decide when auto-register runs [use plugin phases probably?]
3657
3658 // Make sure all UObject classes are registered and default properties have been initialized
3659 {
3660 UE_SCOPED_ENGINE_ACTIVITY(TEXT("Initializing UObject Classes"));
3662 }
3663
3664#if WITH_EDITOR
3665
3666 // To make sure the shader headers are generated correctly, it needs to run after ProcessNewlyLoadedUObjects. ProcessNewlyLoadedUObjects sets up
3667 // the DeviceProfileManager, which is necessary to access certain console variables.
3668 // Also, the shader header needs to be generated before the call to GEditor->InitEditor because some modules (at least Niagara) will generate
3669 // and cache shaders dependencies during plugin loading so I need the shader headers at that moment.
3671 {
3673 }
3674
3676 {
3677 // Explicit initialization of the virtualization system, after slate has initialized and we can show error dialogs.
3679 }
3680#endif //WITH_EDITOR
3681
3682 // Ensure game localization has loaded before we continue
3684
3686
3688
3689#if WITH_EDITOR
3690 if(FPIEPreviewDeviceModule::IsRequestingPreviewDevice())
3691 {
3692 auto PIEPreviewDeviceModule = FModuleManager::LoadModulePtr<IPIEPreviewDeviceModule>("PIEPreviewDeviceProfileSelector");
3694 {
3695 PIEPreviewDeviceModule->ApplyPreviewDeviceState();
3696 }
3697 }
3698#endif
3699#if USE_LOCALIZED_PACKAGE_CACHE
3700 {
3701 SCOPED_BOOT_TIMING("FPackageLocalizationManager::Get().PerformLazyInitialization()");
3702 // CoreUObject is definitely available now, so make sure the package localization cache is available
3703 // This may have already been initialized from the CDO creation from ProcessNewlyLoadedUObjects
3705 }
3706#endif // USE_LOCALIZED_PACKAGE_CACHE
3707
3708 {
3709 SCOPED_BOOT_TIMING("InitDefaultMaterials etc");
3710 // Default materials may have been loaded due to dependencies when loading
3711 // classes and class default objects. If not, do so now.
3715 }
3716 }
3717
3718 {
3719 SCOPED_BOOT_TIMING("IStreamingManager::Get()");
3720 // Initialize the texture streaming system (needs to happen after RHIInit and ProcessNewlyLoadedUObjects).
3722 }
3723
3724 SlowTask.EnterProgressFrame(5);
3725
3726 // Tell the module manager is may now process newly-loaded UObjects when new C++ modules are loaded
3728
3730
3731 SlowTask.EnterProgressFrame(10);
3732
3733 {
3734 SCOPED_BOOT_TIMING("LoadStartupCoreModules");
3736 {
3737 // At least one startup module failed to load, return 1 to indicate an error
3738 return 1;
3739 }
3740 }
3741
3742
3743 SlowTask.EnterProgressFrame(10);
3744
3745 {
3746 SCOPED_BOOT_TIMING("IProjectManager::Get().LoadModulesForProject(ELoadingPhase::PreLoadingScreen)");
3747 // Load up all modules that need to hook into the loading screen
3748 if (!IProjectManager::Get().LoadModulesForProject(ELoadingPhase::PreLoadingScreen) || !IPluginManager::Get().LoadModulesForEnabledPlugins(ELoadingPhase::PreLoadingScreen))
3749 {
3750 return 1;
3751 }
3752 }
3753
3754#if !UE_SERVER
3755 //See if we have an engine loading PreLoadScreen registered, if not try to play an engine loading movie as a backup.
3756 if (IsMoviePlayerEnabled() && !GetMoviePlayer()->IsMovieCurrentlyPlaying())
3757 {
3758 SCOPED_BOOT_TIMING("FPreLoadScreenManager::Get()->Initialize etc");
3759 if (FSlateRenderer* Renderer = FSlateApplication::Get().GetRenderer())
3760 {
3762 {
3763 if (FPreLoadScreenManager::Get()->HasRegisteredPreLoadScreenType(EPreLoadScreenTypes::EngineLoadingScreen))
3764 {
3766 }
3767 else
3768 {
3769 //If we don't have a PreLoadScreen to show, try and initialize old flow with the movie player.
3771 }
3772 }
3773 else
3774 {
3775 GetMoviePlayer()->Initialize(*Renderer, nullptr);
3776 }
3777 }
3778 }
3779#endif
3780
3781 {
3782 SCOPED_BOOT_TIMING("FPlatformApplicationMisc::PostInit");
3783 // do any post appInit processing, before the render thread is started.
3785 }
3786 SlowTask.EnterProgressFrame(5);
3787
3788#if !PLATFORM_SUPPORTS_EARLY_MOVIE_PLAYBACK
3789 {
3790 SCOPED_BOOT_TIMING("PostInitRHI etc");
3791 PostInitRHI();
3792 }
3793
3795#endif // !PLATFORM_SUPPORTS_EARLY_MOVIE_PLAYBACK
3796
3797 // Playing a movie can only happen after the rendering thread is started.
3798#if !UE_SERVER// && !UE_EDITOR
3799 if (IsMoviePlayerEnabled() && !GetMoviePlayer()->IsMovieCurrentlyPlaying())
3800 {
3801 SCOPED_BOOT_TIMING("PlayFirstPreLoadScreen etc");
3803 {
3806 }
3807 else
3808 {
3809 // Play any non-early startup loading movies.
3811 }
3812 }
3813#endif
3814
3815 {
3816 SCOPED_BOOT_TIMING("PlatformHandleSplashScreen etc");
3817#if !UE_SERVER
3819 {
3820 // show or hide splash screen based on movie
3822 }
3823 else
3824#endif
3825 {
3826 // show splash screen
3828 }
3829 }
3830
3831 {
3834 }
3835
3836#if WITH_EDITOR
3837 // We need to mount the shared resources for templates (if there are any) before we try and load and game classes
3838 FUnrealEdMisc::Get().MountTemplateSharedPaths();
3839
3840 // We need to load any animation compression settings before we load game classes
3841 FAnimationUtils::PreloadCompressionSettings();
3842#endif
3843
3844 {
3845 SCOPED_BOOT_TIMING("LoadStartupModules");
3846 if (!LoadStartupModules())
3847 {
3848 // At least one startup module failed to load, return 1 to indicate an error
3849 return 1;
3850 }
3851 }
3852#else // !WITH_ENGINE
3853#if WITH_COREUOBJECT
3854 // Initialize the PackageResourceManager, which is needed to load any (non-script) Packages.
3856#endif
3857#endif // WITH_ENGINE
3858
3859#if WITH_COREUOBJECT
3861 {
3862 SCOPED_BOOT_TIMING("CloseDisregardForGC");
3864 }
3867#endif // WITH_COREUOBJECT
3868
3869#if WITH_ENGINE
3870 if (UOnlineEngineInterface::Get()->IsLoaded())
3871 {
3872 SetIsServerForOnlineSubsystemsDelegate(FQueryIsRunningServer::CreateStatic(&IsServerDelegateForOSS));
3873 }
3874
3875 SlowTask.EnterProgressFrame(5);
3876
3877 if (!bHasEditorToken && !IsRunningDedicatedServer())
3878 {
3879 UClass* CommandletClass = nullptr;
3880
3881 if (!bIsRegularClient)
3882 {
3883 checkf(PRIVATE_GIsRunningCommandlet, TEXT("This should have been set in PreInitPreStartupScreen"));
3884
3885 CommandletClass = Cast<UClass>(StaticFindFirstObject(UClass::StaticClass(), *Token, EFindFirstObjectOptions::None, ELogVerbosity::Warning, TEXT("looking for commandlet")));
3887 if (!CommandletClass && Token.FindChar('.', PeriodIdx))
3888 {
3889 // try to load module for commandlet specified before a period.
3892 }
3893 if (!CommandletClass)
3894 {
3895 if (GLogConsole && !GIsSilent)
3896 {
3897 GLogConsole->Show(true);
3898 }
3899 UE_LOG(LogInit, Error, TEXT("%s looked like a commandlet, but we could not find the class."), *Token);
3900 RequestEngineExit(FString::Printf(TEXT("Failed to find commandlet class %s"), *Token));
3901 return 1;
3902 }
3903
3904#if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_UNIX
3906 {
3907 if (GLogConsole != nullptr && GLogConsole->IsAttached())
3908 {
3909 GLog->RemoveOutputDevice(GLogConsole);
3910 }
3911 // Setup Ctrl-C handler for console application
3913 }
3914 else
3915#endif
3916 {
3917 // Bring up console unless we're a silent build.
3918 if( GLogConsole && !GIsSilent )
3919 {
3920 GLogConsole->Show( true );
3921 }
3922 }
3923
3924 // print output immediately
3925 setvbuf(stdout, nullptr, _IONBF, 0);
3926
3927 UE_LOG(LogInit, Log, TEXT("Executing %s"), *CommandletClass->GetFullName() );
3928
3929 // Allow commandlets to individually override those settings.
3931
3932 if ( IsEngineExitRequested() )
3933 {
3934 // commandlet set IsEngineExitRequested() during construction
3935 return 1;
3936 }
3937
3938 GIsClient = Default->IsClient;
3939 GIsServer = Default->IsServer;
3940#if WITH_EDITOR
3941 GIsEditor = Default->IsEditor;
3942#else
3943 if (Default->IsEditor)
3944 {
3945 UE_LOG(LogInit, Error, TEXT("Cannot run editor commandlet %s with game executable."), *CommandletClass->GetFullName());
3946 RequestEngineExit(TEXT("Tried to run commandlet in non-editor build"));
3947 return 1;
3948 }
3949#endif
3950 // Reset aux log if we don't want to log to the console window.
3951 if( !Default->LogToConsole )
3952 {
3953 GLog->RemoveOutputDevice( GLogConsole );
3954 }
3955
3956 // allow the commandlet the opportunity to create a custom engine
3957 CommandletClass->GetDefaultObject<UCommandlet>()->CreateCustomEngine(CommandletCommandLine);
3958 if ( GEngine == nullptr )
3959 {
3960#if WITH_EDITOR
3961 if ( GIsEditor )
3962 {
3963 FString EditorEngineClassName;
3964 GConfig->GetString(TEXT("/Script/Engine.Engine"), TEXT("EditorEngine"), EditorEngineClassName, GEngineIni);
3965 UClass* EditorEngineClass = StaticLoadClass( UEditorEngine::StaticClass(), nullptr, *EditorEngineClassName);
3966 if (EditorEngineClass == nullptr)
3967 {
3968 UE_LOG(LogInit, Fatal, TEXT("Failed to load Editor Engine class '%s'."), *EditorEngineClassName);
3969 }
3970
3972
3974
3975 UE_LOG(LogInit, Log, TEXT("Initializing Editor Engine..."));
3976 GEditor->InitEditor(this);
3977 UE_LOG(LogInit, Log, TEXT("Initializing Editor Engine Completed"));
3978 }
3979 else
3980#endif
3981 {
3982 FString GameEngineClassName;
3983 GConfig->GetString(TEXT("/Script/Engine.Engine"), TEXT("GameEngine"), GameEngineClassName, GEngineIni);
3984
3985 UClass* EngineClass = StaticLoadClass( UEngine::StaticClass(), nullptr, *GameEngineClassName);
3986
3987 if (EngineClass == nullptr)
3988 {
3989 UE_LOG(LogInit, Fatal, TEXT("Failed to load Engine class '%s'."), *GameEngineClassName);
3990 }
3991
3992 // must do this here so that the engine object that we create on the next line receives the correct property values
3994 check(GEngine);
3995
3997
3998 UE_LOG(LogInit, Log, TEXT("Initializing Game Engine..."));
3999 GEngine->Init(this);
4000 UE_LOG(LogInit, Log, TEXT("Initializing Game Engine Completed"));
4001 }
4002 }
4003
4004 // Call init callbacks
4005 {
4006 SCOPED_NAMED_EVENT_TEXT("FCoreDelegates::OnPostEngineInit", CoreDelegatesColor);
4008 }
4009
4010 // Load all the post-engine init modules
4012 ensure(IPluginManager::Get().LoadModulesForEnabledPlugins(ELoadingPhase::PostEngineInit));
4013
4014 // Call module loading phases completion callbacks
4016
4017 // Disable the backlog only after module loading is complete because that gives modules
4018 // a chance to consume the backlog when constructing output devices.
4019 GLog->EnableBacklog(false);
4020
4021 //run automation smoke tests now that the commandlet has had a chance to override the above flags and GEngine is available
4023
4026 Commandlet->AddToRoot();
4027
4028 // Execute the commandlet.
4030
4031 // Commandlets don't always handle -run= properly in the commandline so we'll provide them
4032 // with a custom version that doesn't have it.
4033 Commandlet->ParseParms( CommandletCommandLine );
4034#if STATS
4035 // We have to close the scope, otherwise we will end with broken stats.
4036 CycleCount_AfterStats.StopAndResetStatId();
4037#endif // STATS
4039
4040#if WITH_ENGINE
4042#endif
4043
4044 {
4045 SCOPED_NAMED_EVENT_TEXT("FCoreDelegates::OnCommandletPreMain", CoreDelegatesColor);
4047 }
4048
4050 {
4051 TRACE_CPUPROFILER_EVENT_SCOPE_TEXT(*WriteToString<512>(TEXT("Commandlet Main "), Commandlet->GetFName()));
4052 FTrackedActivityScope CommandletActivity(FTrackedActivity::GetEngineActivity(), *FString::Printf(TEXT("Running %s"), *Commandlet->GetName()), false, FTrackedActivity::ELight::Green);
4053 ErrorLevel = Commandlet->Main(CommandletCommandLine);
4054 }
4055
4056 {
4057 SCOPED_NAMED_EVENT_TEXT("FCoreDelegates::OnCommandletPostMain", CoreDelegatesColor);
4059 }
4060
4061#if WITH_ENGINE
4063#endif
4064
4066
4067 RequestEngineExit(FString::Printf(TEXT("Commandlet %s finished execution (result %d)"), *Commandlet->GetName(), ErrorLevel));
4068
4069 // Log warning/ error summary.
4070 if( Commandlet->ShowErrorCount )
4071 {
4076
4077 if (AllErrors.Num() || AllWarnings.Num())
4078 {
4080 UE_LOG(LogInit, Display, TEXT(""));
4081 UE_LOG(LogInit, Display, TEXT("Warning/Error Summary (Unique only)"));
4082 UE_LOG(LogInit, Display, TEXT("-----------------------------------"));
4083
4084 const int32 MaxMessagesToShow = (GIsBuildMachine || FParse::Param(FCommandLine::Get(), TEXT("DUMPALLWARNINGS"))) ?
4085 (AllErrors.Num() + AllWarnings.Num()) : 50;
4086
4089
4091
4092 for (const FString& ErrorMessage : AllErrors)
4093 {
4094 bool bAlreadyShown = false;
4095 ShownMessages.Add(ErrorMessage, &bAlreadyShown);
4096
4097 if (!bAlreadyShown)
4098 {
4099 if (ShownMessages.Num() > MaxMessagesToShow)
4100 {
4102 UE_CLOG(MaxMessagesToShow < AllErrors.Num(), LogInit, Display, TEXT("NOTE: Only first %d errors displayed."), MaxMessagesToShow);
4103 break;
4104 }
4105
4106 UE_LOG(LogInit, Display, TEXT("%s"), *ErrorMessage);
4107 }
4108 }
4109
4112
4113 for (const FString& WarningMessage : AllWarnings)
4114 {
4115 bool bAlreadyShown = false;
4117
4118 if (!bAlreadyShown)
4119 {
4120 if (ShownMessages.Num() > MaxMessagesToShow)
4121 {
4123 UE_CLOG(MaxMessagesToShow < AllWarnings.Num(), LogInit, Display, TEXT("NOTE: Only first %d warnings displayed."), MaxMessagesToShow);
4124 break;
4125 }
4126
4128 }
4129 }
4130 }
4131
4132 // Allow the caller to request that we issue an ensure when there are any errors from the executed commandlet
4134
4135 UE_LOG(LogInit, Display, TEXT(""));
4136
4137 if( ErrorLevel != 0 )
4138 {
4140 UE_LOG(LogInit, Display, TEXT("Commandlet->Main return this error code: %d"), ErrorLevel );
4141 UE_LOG(LogInit, Display, TEXT("With %d error(s), %d warning(s)"), AllErrors.Num(), AllWarnings.Num() );
4142 }
4143 else if( ( AllErrors.Num() == 0 ) )
4144 {
4146 UE_LOG(LogInit, Display, TEXT("Success - %d error(s), %d warning(s)"), AllErrors.Num(), AllWarnings.Num() );
4147 }
4148 else
4149 {
4151 UE_LOG(LogInit, Display, TEXT("Failure - %d error(s), %d warning(s)"), AllErrors.Num(), AllWarnings.Num() );
4152 }
4154 }
4155 else
4156 {
4157 UE_LOG(LogInit, Display, TEXT("Finished."));
4158 }
4159
4160 // Return an non-zero code if errors were logged and UseCommandletResultAsExitCode is false
4161 if (!Commandlet->UseCommandletResultAsExitCode)
4162 {
4163 if ((ErrorLevel == 0) && (GWarn->GetNumErrors() > 0))
4164 {
4165 ErrorLevel = 1;
4166 }
4167 }
4168
4170 if (CommandletExecutionTime <= 60)
4171 {
4172 UE_LOG(LogInit, Display, LINE_TERMINATOR TEXT("Execution of commandlet took: %.2f seconds"), CommandletExecutionTime);
4173 }
4174 else
4175 {
4177 int32 Hours = (int32)(ExecutionTimeSpan.GetTotalHours());
4178 int32 Minutes = ExecutionTimeSpan.GetMinutes();
4179 int32 Seconds = ExecutionTimeSpan.GetSeconds();
4180 // Tried FText::AsTimespan here but it actually felt harder to visually parse than just explicit labeling. Leaving the
4181 // seconds in so that it's easy to subtract between multiple runs.
4182 if (Hours)
4183 {
4184 UE_LOG(LogInit, Display, LINE_TERMINATOR TEXT("Execution of commandlet took: %dh %dm %ds (%.2f seconds)"), Hours, Minutes, Seconds, CommandletExecutionTime);
4185 }
4186 else
4187 {
4188 UE_LOG(LogInit, Display, LINE_TERMINATOR TEXT("Execution of commandlet took: %dm %ds (%.2f seconds)"), Minutes, Seconds, CommandletExecutionTime);
4189 }
4190 }
4191
4192 const bool bShouldPerformFastExit = Commandlet->FastExit || FParse::Param(FCommandLine::Get(), TEXT("fastexit"));
4194 {
4196 }
4197
4198 // We're ready to exit!
4199 return ErrorLevel;
4200 }
4201 else
4202 {
4203 // We're a regular client.
4204 check(bIsRegularClient);
4205
4206 if (bIsPossiblyUnrecognizedCommandlet)
4207 {
4208 // here we give people a reasonable warning if they tried to use the short name of a commandlet
4209 UClass* TempCommandletClass = FindFirstObject<UClass>(*(Token + TEXT("Commandlet")), EFindFirstObjectOptions::None, ELogVerbosity::Warning, TEXT("Looking for commandlet class"));
4211 {
4212 UE_LOG(LogInit, Fatal, TEXT("You probably meant to call a commandlet. Please use the full name %s."), *(Token+TEXT("Commandlet")));
4213 }
4214 }
4215 }
4216 }
4217
4218 // exit if wanted.
4219 if( IsEngineExitRequested() )
4220 {
4221 if ( GEngine != nullptr )
4222 {
4223#if WITH_EDITOR
4224 if (GIsEditor)
4225 {
4226 SCOPED_NAMED_EVENT_TEXT("FCoreDelegates::OnEditorPreExit", CoreDelegatesColor);
4227 FEditorDelegates::OnEditorPreExit.Broadcast();
4228 }
4229#endif // WITH_EDITOR
4230
4231 GEngine->PreExit();
4232 }
4233 AppPreExit();
4234 // appExit is called outside guarded block.
4235 return 1;
4236 }
4237
4239
4240 if(FParse::Param(FCommandLine::Get(),TEXT("DUMPMOVIE")))
4241 {
4242 // -1: remain on
4243 GIsDumpingMovie = -1;
4244 }
4245
4246 // If dumping movie then we do NOT want on-screen messages
4248
4249#if !UE_BUILD_SHIPPING
4250 if (FParse::Param(FCommandLine::Get(),TEXT("NOSCREENMESSAGES")))
4251 {
4253 }
4254
4255 if (GEngine && FParse::Param(FCommandLine::Get(), TEXT("statunit")))
4256 {
4257 GEngine->Exec(nullptr, TEXT("stat unit"));
4258 }
4259
4260 // Don't update INI files if benchmarking or -noini
4262 {
4267 }
4268#endif // !UE_BUILD_SHIPPING
4269
4270 // initialize the pointer, as it is deleted before being assigned in the first frame
4271 PendingCleanupObjects = nullptr;
4272
4273 // Initialize profile visualizers.
4274#if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
4275 FModuleManager::Get().LoadModule(TEXT("ProfileVisualizer"));
4276#endif
4277
4278 // Init HighRes screenshot system, unless running on server
4280 {
4282 }
4283
4284 // precache compute PSOs for global shaders - enough time should have passed since loading global SM to avoid a blocking load
4286 {
4288 }
4289
4290 UE::RenderCommandPipe::Initialize();
4291
4292#else // WITH_ENGINE
4296#if USE_LOCALIZED_PACKAGE_CACHE
4297 {
4298 SCOPED_BOOT_TIMING("FPackageLocalizationManager::Get().InitializeFromDefaultCache");
4300 }
4301#endif // USE_LOCALIZED_PACKAGE_CACHE
4302#if WITH_APPLICATION_CORE
4303 {
4304 SCOPED_BOOT_TIMING("FPlatformApplicationMisc::PostInit");
4306 }
4307#endif
4308#endif // WITH_ENGINE
4309
4310 {
4311 SCOPED_BOOT_TIMING("RunSmokeTests");
4312 //run automation smoke tests now that everything is setup to run
4314 }
4315
4316#if WITH_ENGINE && (!UE_BUILD_SHIPPING)
4318 if (RHIUnitTests)
4319 {
4321 }
4322#endif //(!UE_BUILD_SHIPPING)
4323
4325
4326 PreInitContext.Cleanup();
4327
4328 // Note we still have 20% remaining on the slow task: this will be used by the Editor/Engine initialization next
4329 return 0;
4330}
4331
4333{
4334#if UE_ENABLE_ARRAY_SLACK_TRACKING
4335 // Any array allocations before this point won't have array slack tracking, although subsequent reallocations of existing arrays
4336 // will gain tracking if that occurs. The goal is to filter out startup constructors which run before Main, which introduce a
4337 // ton of noise into slack reports. Especially the roughly 30,000 static FString constructors in the code base, each with a
4338 // unique call stack, and all having a little bit of slack due to malloc bucket size rounding.
4340#endif
4341
4343
4344 const int32 rv1 = PreInitPreStartupScreen(CmdLine);
4345 if (rv1 != 0)
4346 {
4347 PreInitContext.Cleanup();
4348 return rv1;
4349 }
4350
4351 const int32 rv2 = PreInitPostStartupScreen(CmdLine);
4352 if (rv2 != 0)
4353 {
4354 PreInitContext.Cleanup();
4355 return rv2;
4356 }
4357
4358 return 0;
4359}
4360
4362{
4363 // Always attempt to load CoreUObject. It requires additional pre-init which is called from its module's StartupModule method.
4364#if WITH_COREUOBJECT
4365 // Always register the UObjects callbacks from the module manager for dynamic loading/unloading.
4367 return FModuleManager::Get().LoadModule(TEXT("CoreUObject")) != nullptr;
4368#else
4369 return true;
4370#endif
4371}
4372
4373
4375{
4376 PreInitContext.Cleanup();
4377}
4378
4380{
4382
4383 // GGetMapNameDelegate is initialized here
4384#if WITH_ENGINE
4385 FModuleManager::Get().LoadModule(TEXT("Engine"));
4386
4387 FModuleManager::Get().LoadModule(TEXT("Renderer"));
4388
4389 FModuleManager::Get().LoadModule(TEXT("AnimGraphRuntime"));
4390
4392
4393#if !UE_SERVER
4395 {
4396 if (!GUsingNullRHI)
4397 {
4398 // This needs to be loaded before InitializeShaderTypes is called
4400 }
4401 }
4402#endif
4403
4404 FModuleManager::Get().LoadModule(TEXT("Landscape"));
4405
4406 FModuleManager::Get().LoadModule(TEXT("RHICore"));
4407
4408 // Initialize ShaderCore before loading or compiling any shaders,
4409 // But after Renderer and any other modules which implement shader types.
4410 FModuleManager::Get().LoadModule(TEXT("RenderCore"));
4411
4412#if WITH_EDITORONLY_DATA
4413 // Load the texture compressor module before any textures load. They may
4414 // compress asynchronously and that can lead to a race condition.
4415 FModuleManager::Get().LoadModule(TEXT("TextureCompressor"));
4416#endif
4417
4418 if (!FPlatformProperties::RequiresCookedData())
4419 {
4420 FModuleManager::Get().LoadModule(TEXT("Virtualization"));
4421 }
4422#endif // WITH_ENGINE
4423
4424#if WITH_EDITOR
4425 // Load audio editor module before engine class CDOs are loaded
4426 FModuleManager::Get().LoadModule(TEXT("AudioEditor"));
4427
4428#if !(UE_BUILD_SHIPPING || UE_BUILD_TEST) // todo: revist
4429 FModuleManager::Get().LoadModule(TEXT("AnimationModifiers"));
4430#endif // !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
4431#endif // WITH_EDITOR
4432}
4433
4434
4435
4436#if WITH_ENGINE
4437
4438bool FEngineLoop::LoadStartupCoreModules()
4439{
4441
4443
4444 bool bSuccess = true;
4445
4446 // Load all Runtime modules
4447 SlowTask.EnterProgressFrame(10);
4448 {
4450 FModuleManager::Get().LoadModule(TEXT("Networking"));
4451 }
4452
4453 // Enable the live coding module if it's a developer build
4454#if WITH_LIVE_CODING
4455 FModuleManager::Get().LoadModule("LiveCoding");
4456#endif
4457
4458 SlowTask.EnterProgressFrame(10);
4460
4461 // initialize messaging
4462 SlowTask.EnterProgressFrame(10);
4464 {
4465 FModuleManager::LoadModuleChecked<IMessagingModule>("Messaging");
4466 }
4467
4468 // Init Scene Reconstruction support
4469#if !UE_SERVER
4471 {
4472 FModuleManager::LoadModuleChecked<IMRMeshModule>("MRMesh");
4473 }
4474#endif
4475
4476 SlowTask.EnterProgressFrame(10);
4477#if WITH_EDITOR
4479 FModuleManager::Get().LoadModuleChecked("LandscapeEditorUtilities");
4480 FModuleManager::Get().LoadModuleChecked("SubobjectDataInterface");
4481#endif //WITH_EDITOR
4482
4483 // Load UI modules
4484 SlowTask.EnterProgressFrame(10);
4485 if ( !IsRunningDedicatedServer() )
4486 {
4487 FModuleManager::Get().LoadModule("SlateCore");
4489
4490#if !UE_BUILD_SHIPPING
4491 // Need to load up the SlateReflector module to initialize the WidgetSnapshotService
4492 FModuleManager::Get().LoadModule("SlateReflector");
4493#endif // !UE_BUILD_SHIPPING
4494 }
4495
4496#if WITH_EDITOR
4497 FModuleManager::Get().LoadModule("EditorStyle");
4498 // In dedicated server builds with the editor, we need to load UMG/UMGEditor for compiling blueprints.
4499 // UMG must be loaded for runtime and cooking.
4501 // ScriptableEditorWidgets was refactored out of UMG, load it now so that we don't break existing
4502 // projets that are not listing it in their uproject or uplugin:
4503 FModuleManager::Get().LoadModule("ScriptableEditorWidgets");
4504#else
4505 if ( !IsRunningDedicatedServer() )
4506 {
4507 // UMG must be loaded for runtime and cooking.
4509 }
4510#endif //WITH_EDITOR
4511
4512 // Load all Development modules
4513 SlowTask.EnterProgressFrame(20);
4515 {
4516#if WITH_UNREAL_DEVELOPER_TOOLS
4517 FModuleManager::Get().LoadModule("MessageLog");
4518#endif // WITH_UNREAL_DEVELOPER_TOOLS
4519#if WITH_EDITOR
4520 FModuleManager::Get().LoadModule("CollisionAnalyzer");
4521#endif // WITH_EDITOR
4522 }
4523
4524#if WITH_UNREAL_DEVELOPER_TOOLS
4525 FModuleManager::Get().LoadModule("FunctionalTesting");
4526#endif //WITH_UNREAL_DEVELOPER_TOOLS
4527
4528 SlowTask.EnterProgressFrame(30);
4529#if (WITH_EDITOR && !(UE_BUILD_SHIPPING || UE_BUILD_TEST)) // todo: revisit
4530 // HACK: load BT editor as early as possible for statically initialized assets (non cooked BT assets needs it)
4531 // cooking needs this module too
4532 FModuleManager::Get().LoadModule(TEXT("BehaviorTreeEditor"));
4533
4534 // Ability tasks are based on GameplayTasks, so we need to make sure that module is loaded as well
4535 FModuleManager::Get().LoadModule(TEXT("GameplayTasksEditor"));
4536#endif
4537
4538#if WITH_EDITOR
4539 IAudioEditorModule* AudioEditorModule = &FModuleManager::LoadModuleChecked<IAudioEditorModule>("AudioEditor");
4540 AudioEditorModule->RegisterAssetActions();
4541#endif // WITH_EDITOR
4542
4543#if (WITH_EDITOR && !(UE_BUILD_SHIPPING || UE_BUILD_TEST)) // todo: revisit
4544 // Load the StringTableEditor module to register its asset actions
4545 FModuleManager::Get().LoadModule("StringTableEditor");
4546
4548 {
4549 // VREditor needs to be loaded in non-server editor builds early, so engine content Blueprints can be loaded during DDC generation
4550 FModuleManager::Get().LoadModule(TEXT("VREditor"));
4551 }
4552
4553 if (IsRunningCommandlet())
4554 {
4555 FModuleManager::Get().LoadModule(TEXT("Blutility"));
4556 }
4557
4558#endif //(WITH_EDITOR && !(UE_BUILD_SHIPPING || UE_BUILD_TEST))
4559
4560#if WITH_EDITOR
4562 {
4563 FModuleManager::Get().LoadModule(TEXT("MaterialEditor"));
4564 }
4565#endif // WITH_EDITOR
4566
4567#if WITH_ENGINE
4568 // Load runtime client modules (which are also needed at cook-time)
4570 {
4571 FModuleManager::Get().LoadModule(TEXT("Overlay"));
4572 }
4573
4574 FModuleManager::Get().LoadModule(TEXT("MediaAssets"));
4575#endif
4576
4577 FModuleManager::Get().LoadModule(TEXT("ClothingSystemRuntimeNv"));
4578#if WITH_EDITOR
4579 FModuleManager::Get().LoadModule(TEXT("ClothingSystemEditor"));
4580 FModuleManager::Get().LoadModule(TEXT("AnimationDataController"));
4581
4582 // Required during serialization of AnimSequence which could happen from async loading thread.
4583 // See UAnimSequence::UpdateFrameRate().
4584 FModuleManager::Get().LoadModule(TEXT("TimeManagement"));
4585
4586 // Required during construction of UAnimBlueprint which could happen from async loading thread.
4587 // See UAnimBlueprint::UAnimBlueprint().
4588 FModuleManager::Get().LoadModule(TEXT("AnimGraph"));
4589
4590 FModuleManager::Get().LoadModule(TEXT("WorldBookmark"));
4591
4592 FModuleManager::Get().LoadModule(TEXT("WorldPartitionEditor"));
4593#endif
4594
4595 FModuleManager::Get().LoadModule(TEXT("PacketHandler"));
4596 FModuleManager::Get().LoadModule(TEXT("NetworkReplayStreaming"));
4597
4598 FModuleManager::Get().LoadModule(TEXT("MassEntity"));
4599
4600 return bSuccess;
4601}
4602
4603
4604bool FEngineLoop::LoadStartupModules()
4605{
4607 LLM_SCOPE_BYNAME(TEXT("Modules"));
4608 SlowTask.EnterProgressFrame(1);
4609 // Load any modules that want to be loaded before default modules are loaded up.
4610 if (!IProjectManager::Get().LoadModulesForProject(ELoadingPhase::PreDefault) || !IPluginManager::Get().LoadModulesForEnabledPlugins(ELoadingPhase::PreDefault))
4611 {
4612 return false;
4613 }
4614
4615 SlowTask.EnterProgressFrame(1);
4616 // Load modules that are configured to load in the default phase
4617 if (!IProjectManager::Get().LoadModulesForProject(ELoadingPhase::Default) || !IPluginManager::Get().LoadModulesForEnabledPlugins(ELoadingPhase::Default))
4618 {
4619 return false;
4620 }
4621
4622 SlowTask.EnterProgressFrame(1);
4623 // Load any modules that want to be loaded after default modules are loaded up.
4624 if (!IProjectManager::Get().LoadModulesForProject(ELoadingPhase::PostDefault) || !IPluginManager::Get().LoadModulesForEnabledPlugins(ELoadingPhase::PostDefault))
4625 {
4626 return false;
4627 }
4628
4629 return true;
4630}
4631
4632
4633void FEngineLoop::InitTime()
4634{
4635 // Init variables used for benchmarking and ticking.
4637 MaxFrameCounter = 0;
4638 MaxTickTime = 0;
4639 TotalTickTime = 0;
4641
4642 float FloatMaxTickTime = 0;
4643#if (!UE_BUILD_SHIPPING || ENABLE_PGO_PROFILE)
4646
4647 // look of a version of seconds that only is applied if FApp::IsBenchmarking() is set. This makes it easier on
4648 // say, iOS, where we have a toggle setting to enable benchmarking, but don't want to have to make user
4649 // also disable the seconds setting as well. -seconds= will exit the app after time even if benchmarking
4650 // is not enabled
4651 // NOTE: This will override -seconds= if it's specified
4653 {
4655 {
4657 }
4658 }
4659
4660 // Use -FPS=X to override fixed tick rate if e.g. -BENCHMARK is used.
4661 float FixedFPS = 0;
4663 if( FixedFPS > 0 )
4664 {
4666 }
4667
4668#endif // !UE_BUILD_SHIPPING
4669
4670 // convert FloatMaxTickTime into number of frames (using 1 / FApp::GetFixedDeltaTime() to convert fps to seconds )
4671 MaxFrameCounter = FMath::TruncToInt(MaxTickTime / FApp::GetFixedDeltaTime());
4672}
4673
4674
4675//called via FCoreDelegates::StarvedGameLoop
4676void GameLoopIsStarved()
4677{
4679}
4680
4681
4682int32 FEngineLoop::Init()
4683{
4685 {
4686#if TRACK_DISK_UTILIZATION
4687 CSV_METADATA(TEXT("BootMBLoaded"), *FString::FromInt(GDiskUtilizationTracker.GetLongTermStats().TotalBytesRead / (1024 * 1024)));
4688#endif
4690 };
4691 LLM_SCOPE(ELLMTag::EngineInitMemory);
4692 SCOPED_BOOT_TIMING("FEngineLoop::Init");
4693
4695
4697 SlowTask.EnterProgressFrame(10);
4698
4700
4701 // Figure out which UEngine variant to use.
4702 UClass* EngineClass = nullptr;
4703 if( !GIsEditor )
4704 {
4705 SCOPED_BOOT_TIMING("Create GEngine");
4706 // We're the game.
4707 FString GameEngineClassName;
4708 GConfig->GetString(TEXT("/Script/Engine.Engine"), TEXT("GameEngine"), GameEngineClassName, GEngineIni);
4709 EngineClass = StaticLoadClass( UGameEngine::StaticClass(), nullptr, *GameEngineClassName);
4710 if (EngineClass == nullptr)
4711 {
4712 UE_LOG(LogInit, Fatal, TEXT("Failed to load Game Engine class '%s'."), *GameEngineClassName);
4713 }
4715 }
4716 else
4717 {
4718#if WITH_EDITOR
4719 // We're UnrealEd.
4721 GConfig->GetString(TEXT("/Script/Engine.Engine"), TEXT("UnrealEdEngine"), UnrealEdEngineClassName, GEngineIni);
4722 EngineClass = StaticLoadClass(UUnrealEdEngine::StaticClass(), nullptr, *UnrealEdEngineClassName);
4723 if (EngineClass == nullptr)
4724 {
4725 UE_LOG(LogInit, Fatal, TEXT("Failed to load UnrealEd Engine class '%s'."), *UnrealEdEngineClassName);
4726 }
4728#else
4729 check(0);
4730#endif
4731 }
4732
4734
4735 check( GEngine );
4736
4738 {
4740 }
4741
4743 {
4745 }
4746
4747 {
4748 SCOPED_BOOT_TIMING("GEngine->ParseCommandline()");
4750 }
4751
4753
4754 {
4755 SCOPED_BOOT_TIMING("InitTime");
4756 InitTime();
4757 }
4758
4759 SlowTask.EnterProgressFrame(60);
4760
4761 {
4762 SCOPED_BOOT_TIMING("GEngine->Init");
4763 GEngine->Init(this);
4764 }
4765
4766 // Call init callbacks
4767 {
4768 SCOPED_BOOT_TIMING("FCoreDelegates::OnPostEngineInit");
4770 }
4771
4772 SlowTask.EnterProgressFrame(30);
4773
4774 // initialize engine instance discovery
4776 {
4777 SCOPED_BOOT_TIMING("SessionService etc");
4778 if (!IsRunningCommandlet())
4779 {
4780 SessionService = FModuleManager::LoadModuleChecked<ISessionServicesModule>("SessionServices").GetSessionService();
4781
4782 if (SessionService.IsValid())
4783 {
4784 SessionService->Start();
4785 }
4786 }
4787
4790 }
4791
4792 {
4793 SCOPED_BOOT_TIMING("IProjectManager::Get().LoadModulesForProject(ELoadingPhase::PostEngineInit)");
4794 // Load all the post-engine init modules
4795 if (!IProjectManager::Get().LoadModulesForProject(ELoadingPhase::PostEngineInit) || !IPluginManager::Get().LoadModulesForEnabledPlugins(ELoadingPhase::PostEngineInit))
4796 {
4797 RequestEngineExit(TEXT("One or more modules failed PostEngineInit"));
4798 return 1;
4799 }
4800 }
4801
4802 // Call module loading phases completion callbacks
4804
4805 // Disable the backlog only after module loading is complete because that gives modules
4806 // a chance to consume the backlog when constructing output devices.
4807 GLog->EnableBacklog(false);
4808
4809 {
4810 SCOPED_BOOT_TIMING("GEngine->Start()");
4811 GEngine->Start();
4812 }
4813
4815
4817 {
4818 SCOPED_BOOT_TIMING("WaitForEngineLoadingScreenToFinish");
4821 }
4822 else if (IsMoviePlayerEnabled())
4823 {
4824 SCOPED_BOOT_TIMING("WaitForMovieToFinish");
4826 }
4827
4829
4830#if !UE_SERVER
4831 // initialize media framework
4832 IMediaModule* MediaModule = FModuleManager::LoadModulePtr<IMediaModule>("Media");
4833
4834 if (MediaModule != nullptr)
4835 {
4837 }
4838#endif
4839
4841
4842 // initialize automation worker
4843#if WITH_AUTOMATION_WORKER
4844 FModuleManager::Get().LoadModule("AutomationWorker");
4845#endif
4846
4847 // Automation tests can be invoked locally in non-editor builds configuration (e.g. performance profiling in Test configuration)
4848#if WITH_ENGINE && !UE_BUILD_SHIPPING
4849 FModuleManager::Get().LoadModule("AutomationController");
4850 FModuleManager::GetModuleChecked<IAutomationControllerModule>("AutomationController").Init();
4851#endif
4852
4853#if WITH_EDITOR
4854 FModuleManager::Get().LoadModule(TEXT("SequenceRecorder"));
4855 FModuleManager::Get().LoadModule(TEXT("SequenceRecorderSections"));
4856#endif
4857
4858 GIsRunning = true;
4859
4860 if (!GIsEditor)
4861 {
4862 // hide a couple frames worth of rendering
4864 }
4865
4867
4869
4870 // Ready to measure thread heartbeat
4872
4874 {
4875#if defined(WITH_CODE_GUARD_HANDLER) && WITH_CODE_GUARD_HANDLER
4876 void CheckImageIntegrity();
4878#endif
4879 }
4880
4881 {
4882 SCOPED_BOOT_TIMING("FCoreDelegates::OnFEngineLoopInitComplete");
4884 }
4886
4887#if BUILD_EMBEDDED_APP
4889 FEmbeddedCommunication::KeepAwake(TEXT("FirstTicks"), true);
4890#endif
4891
4892#if UE_EXTERNAL_PROFILING_ENABLED
4893 FExternalProfiler* ActiveProfiler = FActiveExternalProfilerBase::InitActiveProfiler();
4894 if (ActiveProfiler)
4895 {
4896 ActiveProfiler->Register();
4897 }
4898#endif // UE_EXTERNAL_PROFILING_ENABLED
4899
4901
4904
4905 // Emit logging. Don't edit! Automation looks for this to detect failures during initialization.
4906 UE_LOG(LogInit, Display, TEXT("Engine is initialized. Leaving FEngineLoop::Init()"));
4907 return 0;
4908}
4909
4910
4911// 5.4.2 local change to avoid modifying public headers
4912namespace PipelineStateCache
4913{
4914 // Waits for any pending tasks to complete.
4915 extern RHI_API void WaitForAllTasks();
4916
4917}
4918
4919void FEngineLoop::Exit()
4920{
4921 STAT_ADD_CUSTOMMESSAGE_NAME( STAT_NamedMarker, TEXT( "EngineLoop.Exit" ) );
4922 SCOPED_NAMED_EVENT_TEXT("FEngineLoop::Exit", FrameColor);
4923 TRACE_BOOKMARK(TEXT("EngineLoop.Exit"));
4924
4925 ClearPendingCleanupObjects();
4926
4927 GIsRunning = 0;
4928 GLogConsole = nullptr;
4929
4931
4933 {
4934 // If we exit before the preload screen is done, clean it up before shutting down
4936 {
4939 }
4940
4942 }
4943
4944 // shutdown visual logger and flush all data
4945#if ENABLE_VISUAL_LOG
4946 FVisualLogger::Get().TearDown();
4947#endif
4948
4950
4951#if WITH_ENGINE
4952 // shut down messaging
4953 delete EngineService;
4954 EngineService = nullptr;
4955
4956 delete TraceService;
4957 TraceService = nullptr;
4958
4959 if (SessionService.IsValid())
4960 {
4961 SessionService->Stop();
4962 SessionService.Reset();
4963 }
4964
4966 {
4968 GDistanceFieldAsyncQueue = nullptr;
4969 }
4970
4972 {
4975 }
4976#endif // WITH_ENGINE
4977
4978 // Make sure we're not in the middle of loading something after this point as some
4979 // systems are shut down during PreExit and it can cause issues and crashes if loading continues
4980 // beyond this point.
4982
4983 if ( GEngine != nullptr )
4984 {
4985#if WITH_EDITOR
4986 if (GIsEditor)
4987 {
4988 SCOPED_NAMED_EVENT_TEXT("FCoreDelegates::OnEditorPreExit", CoreDelegatesColor);
4989 FEditorDelegates::OnEditorPreExit.Broadcast();
4990 }
4991#endif // WITH_EDITOR
4992
4993 GEngine->PreExit();
4994 }
4995
4996 if (GEngine != nullptr)
4997 {
4999 }
5000
5001
5002 // Make sure we're not in the middle of loading something.
5003 {
5004 bool bFlushOnExit = true;
5005 if (GConfig)
5006 {
5007 FBoolConfigValueHelper FlushStreamingOnExitHelper(TEXT("/Script/Engine.StreamingSettings"), TEXT("s.FlushStreamingOnExit"), GEngineIni);
5009 }
5010 if (bFlushOnExit)
5011 {
5013 }
5014 else
5015 {
5017 }
5018 // From now on it's not allowed to request new async loads
5019 // any new requests done during the scope of the flush should have been flushed as well, now prevent any new requests
5021 }
5022
5023 // Block till all outstanding resource streaming requests are fulfilled.
5025 {
5028 {
5029 StreamingManager->BlockTillAllRequestsFinished();
5030 }
5031 }
5033
5034 // close all windows
5036
5037#if !UE_SERVER
5039 {
5041 }
5042#endif
5043
5044
5045
5046#if WITH_EDITOR
5047 // These module must be shut down first because other modules may try to access them during shutdown.
5048 // Accessing these modules at shutdown causes instability since the object system will have been shut down and these modules uses uobjects internally.
5049 FModuleManager::Get().UnloadModule("AssetTools", true);
5050
5051#endif // WITH_EDITOR
5052 FModuleManager::Get().UnloadModule("WorldBrowser", true);
5053
5054
5055#if WITH_ENGINE
5056 // Reset any in progress PSO compile requests, reduces pipelinestatecache task wait time.
5058#endif
5059
5060 // Wait for any pending tasks to complete.
5062
5063 AppPreExit();
5064
5065 TermGamePhys();
5066
5067#if WITH_EDITOR
5068 IBulkDataRegistry::Shutdown();
5069#endif
5070
5071#if WITH_COREUOBJECT
5072 // PackageResourceManager depends on AssetRegistry, so must be shutdown before we unload the AssetRegistry module
5074#endif
5075 FModuleManager::Get().UnloadModule("AssetRegistry", true);
5076
5077 // Stop the rendering thread.
5079
5080 // Disable the PSO cache
5082
5083 // Free the global shader map, needs to happen before FShaderCodeLibrary::Shutdown to avoid warnings
5084 // about leaking RHI references.
5086
5087 // Close shader code map, if any
5089
5090 // Stop IoDispatcher after FShaderCodeLibrary, as it holds on to file requests
5091#if WITH_ENGINE
5092 UE::DerivedData::IoStore::TearDownIoDispatcher();
5093#endif
5094#if USE_IO_DISPATCHER
5096 FModuleManager::Get().UnloadModule("IoStoreOnDemandCore", true);
5097#if UE_WITH_IOSTOREONDEMAND
5098 FModuleManager::Get().UnloadModule("IoStoreOnDemand", true);
5099#endif
5100#endif
5101
5102#if WITH_EDITOR
5103 // Make sure we shut this down before the modules are torn down, we can clean this up if/when the
5104 // virtualization module is moved to be a plugin
5106#endif //WITH_EDITOR
5107
5108#if WITH_ENGINE
5109 // Save the hot reload state
5111 if(HotReload != nullptr)
5112 {
5113 HotReload->SaveConfig();
5114 }
5115#endif
5116
5117 // Unload all modules. Note that this doesn't actually unload the module DLLs (that happens at
5118 // process exit by the OS), but it does call ShutdownModule() on all loaded modules in the reverse
5119 // order they were loaded in, so that systems can unregister and perform general clean up.
5120 {
5121 SCOPED_BOOT_TIMING("UnloadModulesAtShutdown");
5123 }
5124
5126
5127#if HAS_GPU_STATS && (RHI_NEW_GPU_PROFILER == 0)
5128 FRealtimeGPUProfiler::SafeRelease();
5129#endif
5130
5132
5133 // Move earlier?
5134#if STATS
5135 FThreadStats::StopThread();
5136#endif
5137
5138 // Clean up the thread pool
5139 // GThreadPool might be a wrapper around GLargeThreadPool so we have to destroy it first
5140 if (GThreadPool != nullptr)
5141 {
5143 }
5144
5145#if WITH_EDITOR
5146 if (GLargeThreadPool != nullptr)
5147 {
5148 GLargeThreadPool->Destroy();
5149 }
5150#endif // WITH_EDITOR
5151
5152 if (GBackgroundPriorityThreadPool != nullptr)
5153 {
5155 }
5156
5157 RHIExit();
5158
5160
5162
5163#if WITH_EDITOR && PLATFORM_WINDOWS
5165#endif
5166
5167#if WITH_ENGINE && FRAMEPRO_ENABLED
5168 FFrameProProfiler::TearDown();
5169#endif // FRAMEPRO_ENABLED
5170
5172}
5173
5174
5175void FEngineLoop::ProcessLocalPlayerSlateOperations() const
5176{
5178
5179 // For all the game worlds drill down to the player controller for each game viewport and process it's slate operation
5180 for ( const FWorldContext& Context : GEngine->GetWorldContexts() )
5181 {
5182 UWorld* CurWorld = Context.World();
5183 if ( CurWorld && CurWorld->IsGameWorld() )
5184 {
5186 TSharedPtr< SViewport > ViewportWidget = GameViewportClient ? GameViewportClient->GetGameViewportWidget() : nullptr;
5187
5188 if ( ViewportWidget.IsValid() )
5189 {
5191 SlateApp.GeneratePathToWidgetUnchecked(ViewportWidget.ToSharedRef(), PathToWidget);
5192
5193 if (PathToWidget.IsValid())
5194 {
5195 for (FConstPlayerControllerIterator Iterator = CurWorld->GetPlayerControllerIterator(); Iterator; ++Iterator)
5196 {
5197 APlayerController* PlayerController = Iterator->Get();
5198 if (PlayerController)
5199 {
5200 if (ULocalPlayer* LocalPlayer = Cast<ULocalPlayer>(PlayerController->Player))
5201 {
5202 TOptional<int32> UserIndex = SlateApp.GetUserIndexForController(LocalPlayer->GetControllerId());
5203 if (UserIndex.IsSet())
5204 {
5205 FReply& TheReply = LocalPlayer->GetSlateOperations();
5206 SlateApp.ProcessExternalReply(PathToWidget, TheReply, UserIndex.GetValue());
5207
5209 }
5210 }
5211 }
5212 }
5213 }
5214 }
5215 }
5216 }
5217}
5218
5219#if WITH_ENGINE
5220void OnStartupContentMounted(FInstallBundleRequestResultInfo Result, bool bDumpEarlyConfigReads, bool bDumpEarlyPakFileReads, bool bReloadConfig, bool bForceQuitAfterEarlyReads)
5221{
5222 if (Result.bIsStartup && Result.Result == EInstallBundleResult::OK)
5223 {
5224 DumpEarlyReads(bDumpEarlyConfigReads, bDumpEarlyPakFileReads, bForceQuitAfterEarlyReads);
5226
5228 }
5229}
5230#endif
5231
5232void DumpEarlyReads(bool bDumpEarlyConfigReads, bool bDumpEarlyPakFileReads, bool bForceQuitAfterEarlyReads)
5233{
5234 if (bDumpEarlyConfigReads)
5235 {
5238 }
5239
5240 if (bDumpEarlyPakFileReads)
5241 {
5244 }
5245
5246 if (bForceQuitAfterEarlyReads)
5247 {
5248 GLog->Flush();
5249 if (GEngine)
5250 {
5251 GEngine->DeferredCommands.Emplace(TEXT("Quit force"));
5252 }
5253 else
5254 {
5255 FPlatformMisc::RequestExit(true, TEXT("DumpEarlyReads"));
5256 }
5257 }
5258}
5259
5261{
5262 if (bReloadConfig)
5263 {
5266 }
5267}
5268
5269bool FEngineLoop::ShouldUseIdleMode() const
5270{
5271 static const auto CVarIdleWhenNotForeground = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("t.IdleWhenNotForeground"));
5272 bool bIdleMode = false;
5273
5274 // Yield cpu usage if desired
5275 if (FApp::IsGame()
5276 && FPlatformProperties::SupportsWindowedMode()
5277 && CVarIdleWhenNotForeground->GetValueOnGameThread()
5278 && !FApp::HasFocus())
5279 {
5280 bIdleMode = true;
5281 }
5282
5283#if BUILD_EMBEDDED_APP
5285 {
5286 bIdleMode = true;
5287 }
5288#endif
5289
5290 if (bIdleMode)
5291 {
5292 for (const FWorldContext& Context : GEngine->GetWorldContexts())
5293 {
5294 if (!Context.World()->AreAlwaysLoadedLevelsLoaded())
5295 {
5296 bIdleMode = false;
5297 break;
5298 }
5299 }
5300 }
5301
5302 return bIdleMode;
5303}
5304
5305#if !UE_BUILD_SHIPPING && !UE_BUILD_TEST && MALLOC_GT_HOOKS
5306
5309 TEXT("LogGameThreadMallocChurn.Enable"),
5310 0,
5311 TEXT("If > 0, then collect sample game thread malloc, realloc and free, periodically print a report of the worst offenders."));
5312
5314 TEXT("LogGameThreadMallocChurn.PrintFrequency"),
5315 300,
5316 TEXT("Number of frames between churn reports."));
5317
5319 TEXT("LogGameThreadMallocChurn.Threshhold"),
5320 10,
5321 TEXT("Minimum average number of allocs per frame to include in the report."));
5322
5324 TEXT("LogGameThreadMallocChurn.SampleFrequency"),
5325 100,
5326 TEXT("Number of allocs to skip between samples. This is used to prevent churn sampling from slowing the game down too much."));
5327
5329 TEXT("LogGameThreadMallocChurn.StackIgnore"),
5330 2,
5331 TEXT("Number of items to discard from the top of a stack frame."));
5332
5334 TEXT("LogGameThreadMallocChurn.RemoveAliases"),
5335 1,
5336 TEXT("If > 0 then remove aliases from the counting process. This essentialy merges addresses that have the same human readable string. It is slower."));
5337
5339 TEXT("LogGameThreadMallocChurn.StackLen"),
5340 3,
5341 TEXT("Maximum number of stack frame items to keep. This improves aggregation because calls that originate from multiple places but end up in the same place will be accounted together."));
5342
5343
5345
5347{
5349 static uint64 DumpFrame;
5350
5351 bool bEnabled;
5352 int32 CountDown;
5353 TFunction<void(int32)> Hook;
5354
5356 : bEnabled(CVarLogGameThreadMallocChurn.GetValueOnGameThread() > 0)
5357 , CountDown(CVarLogGameThreadMallocChurn_SampleFrequency.GetValueOnGameThread())
5358 , Hook(
5359 [this](int32 Index)
5360 {
5361 if (--CountDown <= 0)
5362 {
5363 CountDown = CVarLogGameThreadMallocChurn_SampleFrequency.GetValueOnGameThread();
5364 CollectSample();
5365 }
5366 }
5367 )
5368 {
5369 if (bEnabled)
5370 {
5373 if (!DumpFrame)
5374 {
5375 DumpFrame = GFrameCounter + CVarLogGameThreadMallocChurn_PrintFrequency.GetValueOnGameThread();
5376 GGameThreadMallocChurnTracker.ResetTracking();
5377 }
5378 GGameThreadMallocChurnTracker.ToggleTracking(true, true);
5379 GGameThreadMallocHook = &Hook;
5380 }
5381 else
5382 {
5384 GGameThreadMallocChurnTracker.ToggleTracking(false, true);
5385 if (DumpFrame)
5386 {
5387 DumpFrame = 0;
5388 GGameThreadMallocChurnTracker.ResetTracking();
5389 }
5390 }
5391 }
5393 {
5394 if (bEnabled)
5395 {
5397 check(GGameThreadMallocHook == &Hook);
5398 GGameThreadMallocHook = nullptr;
5399 GGameThreadMallocChurnTracker.ToggleTracking(false, true);
5400 check(DumpFrame);
5401 if (GFrameCounter > DumpFrame)
5402 {
5403 PrintResultsAndReset();
5404 }
5405 }
5406 }
5407
5408 void CollectSample()
5409 {
5411 GGameThreadMallocChurnTracker.CaptureStackTrace(CVarLogGameThreadMallocChurn_StackIgnore.GetValueOnGameThread(), nullptr, CVarLogGameThreadMallocChurn_StackLen.GetValueOnGameThread(), CVarLogGameThreadMallocChurn_RemoveAliases.GetValueOnGameThread() > 0);
5412 }
5413 void PrintResultsAndReset()
5414 {
5415 DumpFrame = GFrameCounter + CVarLogGameThreadMallocChurn_PrintFrequency.GetValueOnGameThread();
5419 GGameThreadMallocChurnTracker.ResetTracking();
5420 }
5421};
5422FStackTracker FScopedSampleMallocChurn::GGameThreadMallocChurnTracker;
5423uint64 FScopedSampleMallocChurn::DumpFrame = 0;
5424
5425#endif
5426
5427#if WITH_RHI_BREADCRUMBS
5429#endif
5430
5431static inline void BeginFrameRenderThread(FRHICommandListImmediate& RHICmdList, uint64 CurrentFrameCounter)
5432{
5433 if ( !FApp::CanEverRender() )
5434 {
5436 return;
5437 }
5438
5441
5442#if !UE_BUILD_SHIPPING
5443
5444 // If we are profiling, kick off a long GPU task to make the GPU always behind the CPU so that we
5445 // won't get GPU idle time measured in profiling results
5446 #if WITH_PROFILEGPU && (RHI_NEW_GPU_PROFILER == 0)
5448 {
5449 IssueScalableLongGPUTask(RHICmdList);
5450 }
5451 #endif
5452
5453#endif // !UE_BUILD_SHIPPING
5454
5455#if WITH_RHI_BREADCRUMBS
5456#if CSV_PROFILER
5457 if (FCsvProfiler::Get()->IsCapturing_Renderthread())
5458 {
5459 GRHIFrameBreadcrumb.Emplace(RHICmdList, RHI_BREADCRUMB_DESC_FORWARD_VALUES(TEXT("Frame"), TEXT("Frame %d (CsvFrame %d)"), RHI_GPU_STAT_ARGS_NONE)(
5461 , RHI_BREADCRUMB_FIELD("Csv Frame Number", FCsvProfiler::Get()->GetCaptureFrameNumberRT())
5462 ));
5463 }
5464 else
5465#endif
5466 {
5469 ));
5470 }
5471#endif
5472
5473 GPU_STATS_BEGINFRAME(RHICmdList);
5474
5475 {
5476 SCOPED_NAMED_EVENT_TEXT("FCoreDelegates::OnBeginFrameRT", CoreDelegatesColor);
5478 }
5479
5481 {
5483 });
5484
5485#if CSV_PROFILER_STATS
5486 FCsvProfiler::BeginExclusiveStat("RenderThreadOther");
5487#endif
5488
5489 GVisualizeTexture.BeginFrameRenderThread();
5490
5491 // Waits after this point but before BeginRenderingViewFamilies are not on the RT critical path (since we're waiting for the GT)
5493}
5494
5495
5496static inline void EndFrameRenderThread(FRHICommandListImmediate& RHICmdList, uint64 CurrentFrameCounter)
5497{
5498 if ( !FApp::CanEverRender() )
5499 {
5500 RHICmdList.EndFrame();
5501 return;
5502 }
5503
5504#if CSV_PROFILER_STATS
5505 FCsvProfiler::EndExclusiveStat("RenderThreadOther");
5506#endif
5507
5509 {
5511 });
5512
5513 {
5514 SCOPED_NAMED_EVENT_TEXT("FCoreDelegates::OnEndFrameRT", CoreDelegatesColor);
5515 FCoreDelegates::OnEndFrameRT.Broadcast();
5516 }
5517
5518 GVisualizeTexture.EndFrameRenderThread();
5519
5520 GPU_STATS_ENDFRAME(RHICmdList);
5521
5522#if WITH_RHI_BREADCRUMBS
5523 GRHIFrameBreadcrumb->End(RHICmdList);
5524 GRHIFrameBreadcrumb.Reset();
5525#endif
5526
5527 RHICmdList.EndFrame();
5528
5530}
5531
5532#if BUILD_EMBEDDED_APP
5534#endif
5535
5536void FEngineLoop::Tick()
5537{
5538 SCOPED_NAMED_EVENT_TEXT("FEngineLoop::Tick", FrameColor);
5539 SCOPE_STALL_COUNTER(FEngineLoop::Tick, 2.0);
5540
5541#if !UE_BUILD_SHIPPING && !UE_BUILD_TEST && MALLOC_GT_HOOKS
5543#endif
5544 // let the low level mem tracker pump once a frame to update states
5545 LLM(FLowLevelMemTracker::Get().UpdateStatsPerFrame());
5546
5547 LLM_SCOPE(ELLMTag::EngineMisc);
5548
5550#if !UE_BUILD_SHIPPING
5551 if (GScopedTestExit.IsValid() && GScopedTestExit->RequestExit())
5552 {
5553 UE_LOG(LogExit, Display, TEXT("**** TestExit: %s ****"), *GScopedTestExit->RequestExitPhrase());
5554 FPlatformMisc::RequestExit(true, TEXT("FEngineLoop::Tick.GScopedTestExit"));
5555 }
5556#endif
5557
5558 {
5560 // Send a heartbeat for the diagnostics thread
5562
5564 }
5565
5566 {
5569 }
5570
5571 // Must be called on the game thread outside of any frame breadcrumbs.
5573
5574 // Make sure something is ticking the rendering tickables in -onethread mode to avoid leaks/bugs.
5576 {
5579 }
5580
5581 // Ensure we aren't starting a frame while loading or playing a loading movie
5583 ensure(!IsMoviePlayerEnabled() || (GetMoviePlayer()->IsLoadingFinished() && !GetMoviePlayer()->IsMovieCurrentlyPlaying()));
5584
5585 // Frame profiling kickoff
5586#if UE_EXTERNAL_PROFILING_ENABLED
5587 FExternalProfiler* ActiveProfiler = FActiveExternalProfilerBase::GetActiveProfiler();
5588 if (ActiveProfiler)
5589 {
5590 ActiveProfiler->FrameSync();
5591 }
5592#endif // UE_EXTERNAL_PROFILING_ENABLED
5593
5595
5597
5598#if ENABLE_NAMED_EVENTS
5599 bool bTraceCpuChannelEnabled = false;
5600#if CPUPROFILERTRACE_ENABLED
5604#endif
5605
5606 // Generate the Frame event string
5607 TCHAR IndexedFrameString[32] = { 0 };
5608 const TCHAR* FrameStringPrefix = bTraceCpuChannelEnabled ? TEXT(" ") : TEXT("Frame ");
5609#if CSV_PROFILER
5610 if (FCsvProfiler::Get()->IsCapturing())
5611 {
5612 FCString::Snprintf(IndexedFrameString, 32, TEXT("Csv%s%d"), FrameStringPrefix, FCsvProfiler::Get()->GetCaptureFrameNumber());
5613 }
5614 else
5615#endif
5616 {
5618 }
5620#if CPUPROFILERTRACE_ENABLED
5622 << Frame.Name(FrameString);
5623#endif // CPUPROFILERTRACE_ENABLED
5624
5625#if PLATFORM_LIMIT_PROFILER_UNIQUE_NAMED_EVENTS
5626 FrameString = TEXT("FEngineLoop");
5627#endif
5629#endif //ENABLE_NAMED_EVENTS
5630
5631 // execute callbacks for cvar changes
5632 {
5635 }
5636
5638
5639 {
5641
5642 #if WITH_PROFILEGPU && !UE_BUILD_SHIPPING && (RHI_NEW_GPU_PROFILER == 0)
5643 // Issue the measurement of the execution time of a basic LongGPUTask unit on the very first frame
5644 // The results will be retrived on the first call of IssueScalableLongGPUTask
5646 {
5648
5650 [](FRHICommandListImmediate& RHICmdList)
5651 {
5653 });
5654 }
5655 #endif
5656
5657#if WITH_ENGINE && CSV_PROFILER
5659#endif
5660
5661 {
5662 SCOPED_NAMED_EVENT_TEXT("FCoreDelegates::OnBeginFrame", CoreDelegatesColor);
5663 FCoreDelegates::OnBeginFrame.Broadcast();
5664 }
5665
5666 // flush debug output which has been buffered by other threads
5667 {
5670 }
5671
5672 // exit if frame limit is reached in benchmark mode, or if time limit is reached
5675 {
5676 FPlatformMisc::RequestExit(false, TEXT("FEngineLoop::Tick.Benchmarking"));
5677 }
5678
5679 // set FApp::CurrentTime, FApp::DeltaTime and potentially wait to enforce max tick rate
5680 {
5684 }
5685
5686 // beginning of RHI frame
5687 {
5690 {
5691 BeginFrameRenderThread(RHICmdList, CurrentFrameCounter);
5692 });
5693
5694 for (FSceneInterface* Scene : GetRendererModule().GetAllocatedScenes())
5695 {
5697 {
5698 Scene->StartFrame();
5699 });
5700 }
5701
5702 UE::RenderCommandPipe::StartRecording();
5703
5704#if !UE_SERVER && WITH_ENGINE
5706 {
5707 // When not in editor, we emit dynamic resolution's begin frame right after RHI's.
5709 }
5710#endif
5711 }
5712
5713 // tick performance monitoring
5714 {
5717
5720 }
5721
5722#if UPDATE_MALLOC_STATS
5723 // update memory allocator stats
5724 {
5726 UE::Private::GMalloc->UpdateStats();
5727 }
5728#endif
5729 }
5730
5731 UE::Stats::FStats::AdvanceFrame( false, UE::Stats::FStats::FOnAdvanceRenderingThreadStats::CreateStatic( &AdvanceRenderingThreadStatsGT ) );
5732
5733 {
5735
5736 // Calculates average FPS/MS (outside STATS on purpose)
5738
5739 // handle some per-frame tasks on the rendering thread
5741 [](FRHICommandListImmediate& RHICmdList)
5742 {
5744 });
5745
5746 // Don't pump messages if we're running embedded as the outer application
5747 // will pass us messages instead.
5749 {
5751
5754 }
5755
5756 bool bIdleMode;
5757 {
5759
5760 // Idle mode prevents ticking and rendering completely
5762 if (bIdleMode)
5763 {
5764 // Yield CPU time
5765 FPlatformProcess::Sleep(.1f);
5766 }
5767 }
5768
5769 // @todo vreditor urgent: Temporary hack to allow world-to-meters to be set before
5770 // input is polled for motion controller devices each frame.
5772 if( GNewWorldToMetersScale != 0.0f )
5773 {
5774#if WITH_ENGINE
5776
5777#if WITH_EDITOR
5778 if( GIsEditor && GEditor->PlayWorld != nullptr && GEditor->bIsSimulatingInEditor )
5779 {
5780 WorldToScale = GEditor->PlayWorld;
5781 }
5782#endif //WITH_EDITOR
5783
5784 if( WorldToScale != nullptr )
5785 {
5786 if( GNewWorldToMetersScale != WorldToScale->GetWorldSettings()->WorldToMeters )
5787 {
5789 }
5790 }
5791
5793 }
5794#endif //WITH_ENGINE
5795
5796 // tick active platform files
5798
5799 // Roughly track the time when the input was sampled
5800 {
5801 SCOPED_NAMED_EVENT_TEXT("FCoreDelegates::OnSamplingInput", CoreDelegatesColor);
5803 }
5804
5805 // process accumulated Slate input
5807 {
5809 SCOPE_TIME_GUARD(TEXT("SlateInput"));
5811 LLM_SCOPE(ELLMTag::UI);
5812
5814 {
5815 TRACE_CPUPROFILER_EVENT_SCOPE(PollGameDeviceState);
5816 SlateApp.PollGameDeviceState();
5817 }
5818 // Gives widgets a chance to process any accumulated input
5819 {
5820 TRACE_CPUPROFILER_EVENT_SCOPE(FinishedInputThisFrame);
5821 SlateApp.FinishedInputThisFrame();
5822 }
5823 }
5824
5825 {
5827 // main game engine tick (world, game objects, etc.)
5829 }
5830
5831 // If a movie that is blocking the game thread has been playing,
5832 // wait for it to finish before we continue to tick or tick again
5833 // We do this right after GEngine->Tick() because that is where user code would initiate a load / movie.
5834 {
5836 {
5837 if (FPreLoadScreenManager::Get()->HasRegisteredPreLoadScreenType(EPreLoadScreenTypes::EngineLoadingScreen))
5838 {
5839 //Wait for any Engine Loading Screen to stop
5841 {
5843 }
5844
5845 //Switch Game Window Back
5846 UGameEngine* GameEngine = Cast<UGameEngine>(GEngine);
5847 if (GameEngine)
5848 {
5850 }
5851 }
5852
5853#if !UE_SERVER
5854 // Is it ok to start up the movie player?
5855 if (IsMoviePlayerEnabled() && !GetMoviePlayer()->IsMovieCurrentlyPlaying())
5856 {
5857 // Enable the MoviePlayer now that the preload screen manager is done.
5858 if (FSlateRenderer* Renderer = FSlateApplication::Get().GetRenderer())
5859 {
5861 }
5862 }
5863#endif // !UE_SERVER
5864
5865 //Destroy / Clean Up PreLoadScreenManager as we are now done
5867 }
5868 else if (IsMoviePlayerEnabled())
5869 {
5870 TRACE_CPUPROFILER_EVENT_SCOPE(WaitForMovieToFinish);
5872 }
5873 }
5874
5876
5878 // Tick the platform and input portion of Slate application, we need to do this before we run things
5879 // concurrent with networking.
5881 {
5882 {
5883 SCOPED_NAMED_EVENT(ProcessLocalPlayerSlateOperations, SystemColor);
5885
5886 // Process slate operations accumulated in the world ticks.
5887 ProcessLocalPlayerSlateOperations();
5888 }
5889
5891 }
5892
5893#if WITH_ENGINE
5894 // process concurrent Slate tasks
5898
5899 const UGameViewportClient* const GameViewport = GEngine->GameViewport;
5900 const UWorld* const GameViewportWorld = GameViewport ? GameViewport->GetWorld() : nullptr;
5901 UDemoNetDriver* const CurrentDemoNetDriver = GameViewportWorld ? GameViewportWorld->GetDemoNetDriver() : nullptr;
5902
5903 const bool bValidateReplicatedProperties = CurrentDemoNetDriver && CVarDoAsyncEndOfFrameTasksValidateReplicatedProperties.GetValueOnGameThread() != 0;
5904
5906 {
5907 const float DeltaSeconds = FApp::GetDeltaTime();
5908
5909 if (CurrentDemoNetDriver && CurrentDemoNetDriver->ShouldTickFlushAsyncEndOfFrame())
5910 {
5913
5915 [CurrentDemoNetDriver, DeltaSeconds]()
5916 {
5917 if (CVarDoAsyncEndOfFrameTasksRandomize.GetValueOnAnyThread(true) > 0)
5918 {
5919 FPlatformProcess::Sleep(FMath::RandRange(0.0f, .003f)); // this shakes up the threading to find race conditions
5920 }
5921
5922 if (CurrentDemoNetDriver != nullptr)
5923 {
5924 CurrentDemoNetDriver->TickFlushAsyncEndOfFrame(DeltaSeconds);
5925 }
5926 },
5928 check(ConcurrentTask.IsValid());
5929
5930 // If we're validating, we want to only test the slate tick so wait for the task
5932 {
5934
5940 ConcurrentTask = nullptr;
5941 }
5942 }
5943 }
5944
5945 // Optionally validate that Slate has not modified any replicated properties for client replay recording.
5948 {
5949 PreSlateObjectStates = CurrentDemoNetDriver->SavePropertyState();
5950 }
5951#endif
5952
5953 // Tick(Advance) Time for the application and then tick and paint slate application widgets.
5954 // We split separate this action from the one above to permit running network replication concurrent with slate widget ticking and painting.
5956 {
5958
5962 }
5963
5964#if WITH_ENGINE
5966 {
5969 {
5970 UE_LOG(LogInit, Log, TEXT("Replicated properties changed during Slate tick!"));
5971 }
5972 }
5973
5974 if (ConcurrentTask.GetReference())
5975 {
5977
5983 ConcurrentTask = nullptr;
5984 }
5985#endif
5986
5987#if STATS
5988 // Clear any stat group notifications we have pending just in case they weren't claimed during FSlateApplication::Get().Tick
5989 extern CORE_API void ClearPendingStatGroups();
5991#endif
5992
5993#if WITH_EDITOR && !UE_BUILD_SHIPPING
5994 // tick automation controller (Editor only)
5995 {
5997 static FName AutomationController("AutomationController");
5998 if (FModuleManager::Get().IsModuleLoaded(AutomationController))
5999 {
6000 FModuleManager::GetModuleChecked<IAutomationControllerModule>(AutomationController).Tick();
6001 }
6002 }
6003#endif
6004
6005#if WITH_ENGINE && WITH_AUTOMATION_WORKER
6006 // tick automation worker
6007 {
6009 static const FName AutomationWorkerModuleName = TEXT("AutomationWorker");
6010 if (FModuleManager::Get().IsModuleLoaded(AutomationWorkerModuleName))
6011 {
6012 FModuleManager::GetModuleChecked<IAutomationWorkerModule>(AutomationWorkerModuleName).Tick();
6013 }
6014 }
6015#endif
6016
6017 {
6019
6020 UE::RenderCommandPipe::StopRecording();
6021
6022 for (FSceneInterface* Scene : GetRendererModule().GetAllocatedScenes())
6023 {
6025 {
6026 Scene->EndFrame(RHICmdList);
6027 });
6028 }
6029
6030 // tick render hardware interface
6031 {
6033 RHITick( FApp::GetDeltaTime() ); // Update RHI.
6034 }
6035 }
6036
6037 // We need to set this marker before EndFrameRenderThread is enqueued.
6038 // If multithreaded rendering is off, it can cause a bad ordering of game and rendering markers.
6040
6041 // Disregard first few ticks for total tick time as it includes loading and such.
6042 if (GFrameCounter > 5)
6043 {
6045 }
6046
6047 // Find the objects which need to be cleaned up the next frame.
6050
6051 // This could be perhaps moved down to get greater parallelism
6052 // Sync game and render/RHI threads.
6054
6055 // tick core ticker, threads & deferred commands
6056 {
6059 // Delete the objects which were enqueued for deferred cleanup before the previous frame.
6060
6061 {
6063
6065#if WITH_COREUOBJECT
6066 DeleteLoaders(); // destroy all linkers pending delete
6067#endif
6068 }
6069
6070 {
6074 }
6075
6076 {
6079 }
6080 }
6082
6083#if !UE_SERVER
6084 // tick media framework
6085 static const FName MediaModuleName(TEXT("Media"));
6086 IMediaModule* MediaModule = FModuleManager::LoadModulePtr<IMediaModule>(MediaModuleName);
6087 if (MediaModule != nullptr)
6088 {
6090 MediaModule->TickPostRender();
6091 }
6092#endif
6093
6094 {
6095 SCOPED_NAMED_EVENT_TEXT("FCoreDelegates::OnEndFrame", CoreDelegatesColor);
6096 FCoreDelegates::OnEndFrame.Broadcast();
6097 }
6098
6099 // Increment global frame counter. Once for each engine tick.
6100 GFrameCounter++;
6101
6102 ENQUEUE_RENDER_COMMAND(FrameCounter)(
6104 {
6106 });
6107
6108#if WITH_ENGINE && CSV_PROFILER
6109 // By design, update this after incrementing GFrameCounter. Calls PlatformMemoryHelpers::GetFrameMemoryStats, which caches
6110 // memory stats based on the value of GFrameCounter. Placing this after the increment guarantees that cached memory stats are
6111 // canonically updated at this same point each frame, as opposed to arbitrarily in various other code paths (at least when the
6112 // CSV profiler is compiled in, which is true in all builds except shipping).
6114#endif
6115
6116 {
6118
6119 // Tick DumpGPU to start/stop frame dumps
6120#if WITH_ENGINE && WITH_DUMPGPU
6121 UE::RenderCore::DumpGPU::TickEndFrame();
6122#endif
6123
6124#if !UE_SERVER && WITH_ENGINE
6125 {
6126 // We emit dynamic resolution's end frame right before RHI's. GEngine is going to ignore it if no BeginFrame was done.
6128 }
6129#endif
6130
6131 // end of RHI frame
6134 {
6135 EndFrameRenderThread(RHICmdList, CurrentFrameCounter);
6136 });
6137 }
6138
6139 // Set CPU utilization stats.
6141 SET_FLOAT_STAT( STAT_CPUTimePct, CPUTime.CPUTimePct );
6142 SET_FLOAT_STAT( STAT_CPUTimePctRelative, CPUTime.CPUTimePctRelative );
6143
6144 // Set the UObject count stat
6145#if !UE_BUILD_TEST && !UE_BUILD_SHIPPING
6147#endif // !UE_BUILD_TEST && !UE_BUILD_SHIPPING
6148 }
6149
6151
6152#if BUILD_EMBEDDED_APP
6153 static double LastSleepTime = FPlatformTime::Seconds();
6155 if (LastSleepTime > 0 && TimeNow - LastSleepTime >= CVarSecondsBeforeEmbeddedAppSleeps.GetValueOnAnyThread())
6156 {
6157 LastSleepTime = 0;
6159 }
6160#endif
6161
6162#if PLATFORM_MAC
6163 // drain the apple async task queue from the game thread
6164 [FAppleAsyncTask ProcessAsyncTasks];
6165#endif
6166}
6167
6168
6169void FEngineLoop::ClearPendingCleanupObjects()
6170{
6172 delete PendingCleanupObjects;
6173 PendingCleanupObjects = nullptr;
6174}
6175
6176#endif // WITH_ENGINE
6177
6178
6179static TAutoConsoleVariable<int32> CVarLogTimestamp(
6180 TEXT("log.Timestamp"),
6181 1,
6182 TEXT("Defines if time is included in each line in the log file and in what form. Layout: [time][frame mod 1000]\n"
6183 " 0 = Do not display log timestamps\n"
6184 " 1 = Log time stamps in UTC and frame time (default) e.g. [2015.11.25-21.28.50:803][376]\n"
6185 " 2 = Log timestamps in seconds elapsed since GStartTime e.g. [0130.29][420]"
6186 " 3 = Log timestamps in local time and frame time e.g. [2017.08.04-17.59.50:803][420]"
6187 " 4 = Log timestamps with the engine's timecode and frame time e.g. [17:59:50:18][420]"),
6188 ECVF_Default);
6189
6190
6191static TAutoConsoleVariable<int32> CVarLogCategory(
6192 TEXT("log.Category"),
6193 1,
6194 TEXT("Defines if the categoy is included in each line in the log file and in what form.\n"
6195 " 0 = Do not log category\n"
6196 " 2 = Log the category (default)"),
6197 ECVF_Default);
6198
6199
6200// Gets called any time cvars change (on the main thread)
6201static void CVarLogSinkFunction()
6202{
6203 {
6204 // for debugging
6206
6207 int32 LogTimestampValue = CVarLogTimestamp.GetValueOnGameThread();
6208
6209 // Note GPrintLogTimes can be used on multiple threads but it should be no issue to change it on the fly
6210 switch(LogTimestampValue)
6211 {
6212 default:
6213 case 0: GPrintLogTimes = ELogTimes::None; break;
6214 case 1: GPrintLogTimes = ELogTimes::UTC; break;
6216 case 3: GPrintLogTimes = ELogTimes::Local; break;
6217 case 4: GPrintLogTimes = ELogTimes::Timecode; break;
6218 }
6219 }
6220
6221 {
6222 int32 LogCategoryValue = CVarLogCategory.GetValueOnGameThread();
6223
6224 // Note GPrintLogCategory can be used on multiple threads but it should be no issue to change it on the fly
6226 }
6227}
6228
6229
6230FAutoConsoleVariableSink CVarLogSink(FConsoleCommandDelegate::CreateStatic(&CVarLogSinkFunction));
6231
6232static void CheckForPrintTimesOverride()
6233{
6234 // Determine whether to override the default setting for including timestamps in the log.
6235 FString LogTimes;
6236 if (GConfig->GetString( TEXT( "LogFiles" ), TEXT( "LogTimes" ), LogTimes, GEngineIni ))
6237 {
6238 if (LogTimes == TEXT( "None" ))
6239 {
6240 CVarLogTimestamp->Set((int)ELogTimes::None, ECVF_SetBySystemSettingsIni);
6241 }
6242 else if (LogTimes == TEXT( "UTC" ))
6243 {
6244 CVarLogTimestamp->Set((int)ELogTimes::UTC, ECVF_SetBySystemSettingsIni);
6245 }
6246 else if (LogTimes == TEXT( "SinceStart" ))
6247 {
6249 }
6250 else if (LogTimes == TEXT( "Local" ))
6251 {
6252 CVarLogTimestamp->Set((int)ELogTimes::Local, ECVF_SetBySystemSettingsIni);
6253 }
6254 else if (LogTimes == TEXT( "Timecode" ))
6255 {
6256 CVarLogTimestamp->Set((int)ELogTimes::Timecode, ECVF_SetBySystemSettingsIni);
6257 }
6258 // Assume this is a bool for backward compatibility
6259 else if (FCString::ToBool( *LogTimes ))
6260 {
6261 CVarLogTimestamp->Set((int)ELogTimes::UTC, ECVF_SetBySystemSettingsIni);
6262 }
6263 }
6264
6265 if (FParse::Param( FCommandLine::Get(), TEXT( "LOGTIMES" ) ))
6266 {
6267 CVarLogTimestamp->Set((int)ELogTimes::UTC, ECVF_SetByCommandline);
6268 }
6269 else if (FParse::Param( FCommandLine::Get(), TEXT( "UTCLOGTIMES" ) ))
6270 {
6271 CVarLogTimestamp->Set((int)ELogTimes::UTC, ECVF_SetByCommandline);
6272 }
6273 else if (FParse::Param( FCommandLine::Get(), TEXT( "NOLOGTIMES" ) ))
6274 {
6275 CVarLogTimestamp->Set((int)ELogTimes::None, ECVF_SetByCommandline);
6276 }
6277 else if (FParse::Param( FCommandLine::Get(), TEXT( "LOGTIMESINCESTART" ) ))
6278 {
6279 CVarLogTimestamp->Set((int)ELogTimes::SinceGStartTime, ECVF_SetByCommandline);
6280 }
6281 else if (FParse::Param( FCommandLine::Get(), TEXT( "LOCALLOGTIMES" ) ))
6282 {
6283 CVarLogTimestamp->Set((int)ELogTimes::Local, ECVF_SetByCommandline);
6284 }
6285 else if (FParse::Param(FCommandLine::Get(), TEXT( "LOGTIMECODE" )))
6286 {
6287 CVarLogTimestamp->Set((int)ELogTimes::Timecode, ECVF_SetByCommandline);
6288 }
6289}
6290
6291#if UE_EDITOR
6292//Standardize paths when deciding if running the proper editor exe.
6293void CleanUpPath(FString& InPath)
6294{
6295 //Converts to full path will also replace '\' with '/' and will collapse relative directories (C:\foo\..\bar to C:\bar)
6298}
6299
6301{
6303
6305 {
6306 return false;
6307 }
6308
6309 // We do not return on Receipt.Read returning false, as Target upgrade requirements occur before a full target receipt can be emitted.
6310 // Only partial target receipts exist, of which the most important properties are BuildSettingsVersion && TargetBuildEnvironment.
6312
6313 // Handle backwards compatibility before we added these properties to the receipt at 5.7.
6314 if (Receipt.BuildSettingsVersion.IsEmpty() || Receipt.TargetBuildEnvironment.IsEmpty())
6315 {
6316 UE_LOG(
6317 LogInit,
6318 Log,
6319 TEXT("Unable to discern build settings version & build environment used for target - target may require upgrade. Target file: %s"),
6321 );
6322 return false;
6323 }
6324
6325 InTargetName = Receipt.TargetName;
6326 const bool bIsShared = (Receipt.TargetBuildEnvironment == TEXT("Shared"));
6327 const bool bIsUpToDate = (Receipt.BuildSettingsVersion == TEXT("V6"));
6328
6329 if (!bIsUpToDate && bIsShared)
6330 {
6331 UE_LOG(
6332 LogInit,
6333 Warning,
6334 TEXT("Current target requires upgrade to V6, as it is not a unique build environment. File: %s, BuildSettingsVersion: %s, TargetBuildEnvironment: %s"),
6336 *Receipt.BuildSettingsVersion,
6337 *Receipt.TargetBuildEnvironment
6338 );
6339
6340 return true;
6341 }
6342
6343 return false;
6344}
6345
6347{
6350 {
6351 return false;
6352 }
6353
6354 // Returning false for -Cmd matches legacy behavior; do we want to change this?
6355 const bool bCheckLaunch_true = true, bCheckCmd_false = false;
6356 return Receipt.LaunchesCurrentExecutable(bCheckLaunch_true, bCheckCmd_false);
6357}
6358
6360{
6361 // Don't allow relaunching the executable if we're running some unattended scripted process.
6362 if(FApp::IsUnattended())
6363 {
6364 return false;
6365 }
6366
6367 // Figure out the executable that we should be running
6368 FString LaunchExecutableName;
6369 if(EditorTargetFileName.Len() == 0)
6370 {
6372 }
6373 else
6374 {
6377 {
6378 return false;
6379 }
6381 }
6383
6384 // Get the current executable name. Don't allow relaunching if we're running the console app.
6387 {
6388 return false;
6389 }
6391
6392 // Nothing to do if they're the same
6394 {
6395 return false;
6396 }
6397
6398 // Relaunch the correct executable
6399 UE_LOG(LogInit, Display, TEXT("Running incorrect executable for target (%s). Launching %s instead..."), *CurrentExecutableName, *LaunchExecutableName);
6400 FPlatformProcess::CreateProc(*IFileManager::Get().ConvertToAbsolutePathForExternalAppForRead(*LaunchExecutableName), FCommandLine::GetOriginal(), true, false, false, nullptr, 0, nullptr, nullptr, nullptr);
6401 return true;
6402}
6403#endif
6404
6405/* FEngineLoop static interface
6406 *****************************************************************************/
6407
6408
6410{
6411 {
6412 SCOPED_BOOT_TIMING("BeginInitTextLocalization");
6414 }
6415
6416
6417
6418 // Error history.
6420
6421 // Platform specific pre-init.
6422 {
6423 SCOPED_BOOT_TIMING("FPlatformMisc::PlatformPreInit");
6425 }
6426#if WITH_APPLICATION_CORE
6427 {
6428 SCOPED_BOOT_TIMING("FPlatformApplicationMisc::PreInit");
6430 }
6431#endif
6432
6433 // Keep track of start time.
6435
6436 // Switch into executable's directory.
6437#if !defined(DISABLE_CWD_CHANGES) || DISABLE_CWD_CHANGES==0
6439#endif
6440
6441 {
6442 SCOPED_BOOT_TIMING("IFileManager::Get().ProcessCommandLineOptions()");
6443 // Now finish initializing the file manager after the command line is set up
6445 }
6446
6448
6449 if (FParse::Param(FCommandLine::Get(), TEXT("purgatorymallocproxy")))
6450 {
6452 }
6453
6454 if (FParse::Param(FCommandLine::Get(), TEXT("poisonmallocproxy")))
6455 {
6457 }
6458
6459#if !UE_BUILD_SHIPPING
6460 if (FParse::Param(FCommandLine::Get(), TEXT("BUILDMACHINE")))
6461 {
6462 GIsBuildMachine = true;
6463 // propagate to subprocesses, especially because some - like ShaderCompileWorker - use DDC, for which this switch matters
6465 }
6466#endif // !UE_BUILD_SHIPPING
6467
6468#if PLATFORM_WINDOWS
6469
6470 // make sure that the log directory tree exists
6472
6473 // update the mini dump filename now that we have enough info to point it to the log folder even in installed builds
6474 FCString::Strcpy(MiniDumpFilenameW, *IFileManager::Get().ConvertToAbsolutePathForExternalAppForWrite(*FString::Printf(TEXT("%sunreal-v%i-%s.dmp"), *FPaths::ProjectLogDir(), FEngineVersion::Current().GetChangelist(), *FDateTime::Now().ToString())));
6475#endif
6476 {
6477 SCOPED_BOOT_TIMING("FPlatformOutputDevices::SetupOutputDevices");
6478 // Init logging to disk
6480 }
6481
6482 {
6483 SCOPED_BOOT_TIMING("FConfigCacheIni::InitializeConfigSystem");
6484 LLM_SCOPE(ELLMTag::ConfigSystem);
6485 // init config system
6487 }
6488
6489#if WITH_EDITOR
6490 if (GIsEditor)
6491 {
6493 GConfig->GetInt(TEXT("NameTable"), TEXT("PreallocateNames"), NumPreallocateNames, GEditorIni);
6495 GConfig->GetInt(TEXT("NameTable"), TEXT("PreallocateNameMemoryMB"), PreAllocateNameMB, GEditorIni);
6497 {
6499 }
6500 }
6501#endif
6502
6503 {
6504 SCOPED_BOOT_TIMING("ConfigUtilities::ApplyCVarsFromBootHotfix");
6505 // Apply boot hotfixes
6507 }
6508
6509 // Apply config driven presets
6511
6513
6514 // Load "asap" plugin modules
6515 IPluginManager& PluginManager = IPluginManager::Get();
6518 {
6519 return false;
6520 }
6521
6523
6524 {
6525 SCOPED_BOOT_TIMING("FPlatformStackWalk::Init");
6526 // Now that configs have been initialized, setup stack walking options
6528 }
6529
6530 CheckForPrintTimesOverride();
6531
6532 // Check whether the project or any of its plugins are missing or are out of date
6533#if UE_EDITOR && !IS_MONOLITHIC
6535 {
6536 // Check all the plugins are present
6537 if(!PluginManager.AreRequiredPluginsAvailable())
6538 {
6539 return false;
6540 }
6541
6542 // Find the editor target
6543 FString EditorTargetFileName;
6544 FString DefaultEditorTarget;
6545 bool bIsRunningExe = false;
6546 GConfig->GetString(TEXT("/Script/BuildSettings.BuildSettings"), TEXT("DefaultEditorTarget"), DefaultEditorTarget, GEngineIni);
6547
6548 // If we have multiple targets for the same code, then try to find a target that matches the running executable. Otherwise
6549 // we use the first matching target.
6550 for (const FTargetInfo& Target : FDesktopPlatformModule::Get()->GetTargetsForProject(FPaths::GetProjectFilePath()))
6551 {
6552 if (Target.Type == EBuildTargetType::Editor)
6553 {
6555
6558 {
6560 }
6561 else if (FPaths::IsUnderDirectory(Target.Path, FPaths::EngineDir()))
6562 {
6564 }
6565
6567 {
6569 bIsRunningExe = true;
6570 break;
6571 }
6572 else if (DefaultEditorTarget.Len() == 0 || Target.Name == DefaultEditorTarget)
6573 {
6574 if (EditorTargetFileName.Len() == 0)
6575 {
6577 }
6578 }
6579 }
6580 }
6581
6582 // If we're not running the correct executable for the current target, and the listed executable exists, run that instead
6584 {
6585 return false;
6586 }
6587
6588 // Check if we need to compile
6589 bool bNeedCompile = false;
6590 GConfig->GetBool(TEXT("/Script/UnrealEd.EditorLoadingSavingSettings"), TEXT("bForceCompilationAtStartup"), bNeedCompile, GEditorPerProjectIni);
6591 if(FParse::Param(FCommandLine::Get(), TEXT("SKIPCOMPILE")) || FParse::Param(FCommandLine::Get(), TEXT("MULTIPROCESS")))
6592 {
6593 bNeedCompile = false;
6594 }
6595 if(!bNeedCompile)
6596 {
6597 // Check if any of the target, project or plugin modules are out of date, and the user wants to compile them.
6598 FString targetName;
6600
6602 {
6603 FString TargetRequiresUpgradeMessage = FString::Printf(
6604 TEXT("The last build used an outdated BuildSettingsVersion, or the target still requires upgrading."
6605 "\n\nPlease upgrade %s.Target.cs:"
6606 "\n\n Update the build settings version (Installed Engine Build & Source Build):"
6607 "\n DefaultBuildSettings = BuildSettingsVersion.V6;"
6608 "\n\n OR"
6609 "\n\n Declare a unique build environment (Source Build only):"
6610 "\n BuildEnvironment = TargetBuildEnvironment.Unique;"
6611 "\n\nIf you have already updated the target, would you like to rebuild & open the project?"),
6612 *targetName
6613 );
6614
6616 {
6617 return false;
6618 }
6619
6620 // Rebuilding should update the target receipt file, and prevent subsequent checks.
6621 bNeedCompile = true;
6622 }
6623
6625 ProjectManager.CheckModuleCompatibility(IncompatibleFiles);
6626
6629
6630 if (IncompatibleFiles.Num() > 0)
6631 {
6632 // Log the modules which need to be rebuilt
6633 for (int Idx = 0; Idx < IncompatibleFiles.Num(); Idx++)
6634 {
6635 UE_LOG(LogInit, Warning, TEXT("Incompatible or missing module: %s"), *IncompatibleFiles[Idx]);
6636 }
6637
6638 // Build the error message for the dialog box
6639 FString ModulesList = TEXT("The following modules are missing or built with a different engine version:\n\n");
6640
6641 int NumModulesToDisplay = (IncompatibleFiles.Num() <= 20)? IncompatibleFiles.Num() : 15;
6642 for (int Idx = 0; Idx < NumModulesToDisplay; Idx++)
6643 {
6644 ModulesList += FString::Printf(TEXT(" %s\n"), *IncompatibleFiles[Idx]);
6645 }
6647 {
6648 ModulesList += FString::Printf(TEXT(" (+%d others, see log for details)\n"), IncompatibleFiles.Num() - NumModulesToDisplay);
6649 }
6650
6651 // If we're running with -stdout, assume that we're a non interactive process and about to fail
6653 {
6654 return false;
6655 }
6656
6657 // If there are any engine modules that need building, force the user to build through the IDE
6658 if(IncompatibleEngineFiles.Num() > 0)
6659 {
6660 FString CompileForbidden = ModulesList + TEXT("\nEngine modules cannot be compiled at runtime. Please build through your IDE.");
6662 return false;
6663 }
6664
6665 // Ask whether to compile before continuing
6666 FString CompilePrompt = ModulesList + TEXT("\nWould you like to rebuild them now?");
6668 {
6669 bNeedCompile = true;
6670 }
6671 else
6672 {
6673 FString ProceedWithoutCompilePrompt = ModulesList + TEXT("\nWould you like to proceed anyway? Code and content that depends on these modules may not work correctly. Enter at your own risk.");
6675 {
6676 return false;
6677 }
6678 }
6679 }
6681 {
6682 // Prompt to compile. The target file isn't essential, but we
6683 if (FPlatformMisc::MessageBoxExt(EAppMsgType::YesNo, *FString::Printf(TEXT("The %s file does not exist. Would you like to build the editor?"), *FPaths::GetCleanFilename(EditorTargetFileName)), TEXT("Missing target file")) == EAppReturnType::Yes)
6684 {
6685 bNeedCompile = true;
6686 }
6687 }
6688 }
6689
6691
6692 if(bNeedCompile)
6693 {
6694 // Try to compile it
6695 FFeedbackContext *Context = (FFeedbackContext*)FDesktopPlatformModule::Get()->GetNativeFeedbackContext();
6696 Context->BeginSlowTask(FText::FromString(TEXT("Starting build...")), true, true);
6698 bool bCompileResult = FDesktopPlatformModule::Get()->CompileGameProject(FPaths::RootDir(), FPaths::GetProjectFilePath(), Context, &CompilationResult);
6699 Context->EndSlowTask();
6700
6701 // Check if we're running the wrong executable now
6703 {
6704 return false;
6705 }
6706
6707 // Check if we needed to modify engine files
6709 {
6710 FPlatformMisc::MessageBoxExt(EAppMsgType::Ok, TEXT("Engine modules are out of date, and cannot be compiled while the engine is running. Please build through your IDE."), TEXT("Missing Modules"));
6711 return false;
6712 }
6713
6714 // Get a list of modules which are still incompatible
6716 ProjectManager.CheckModuleCompatibility(StillIncompatibleFiles);
6717
6720
6721 if(!bCompileResult || StillIncompatibleFiles.Num() > 0)
6722 {
6723 for (int Idx = 0; Idx < StillIncompatibleFiles.Num(); Idx++)
6724 {
6725 UE_LOG(LogInit, Warning, TEXT("Still incompatible or missing module: %s"), *StillIncompatibleFiles[Idx]);
6726 }
6727 if (!FApp::IsUnattended())
6728 {
6729 FPlatformMisc::MessageBoxExt(EAppMsgType::Ok, *FString::Printf(TEXT("%s could not be compiled. Try rebuilding from source manually."), FApp::GetProjectName()), TEXT("Error"));
6730 }
6731 return false;
6732 }
6733 }
6734 }
6735#endif
6736
6737 // Put the command line and config info into the suppression system (before plugins start loading)
6739
6740#if PLATFORM_IOS || PLATFORM_TVOS
6741 // Now that the config system is ready, init the audio system.
6742 [[IOSAppDelegate GetDelegate] InitializeAudioSession];
6743#endif
6744
6745 // Show log if wanted.
6747 {
6748 GLogConsole->Show(true);
6749 }
6750
6751
6752 // NOTE: This is the earliest place to init the online subsystems (via plugins)
6753 // Code needs GConfigFile to be valid
6754 // Must be after FThreadStats::StartThread();
6755 // Must be before Render/RHI subsystem D3DCreate() for platform services that need D3D hooks like Steam
6756
6757 {
6758 SCOPED_BOOT_TIMING("Load pre-init plugin modules");
6759 UE_SCOPED_ENGINE_ACTIVITY(TEXT("Loading Plugins (PreInit)"));
6760
6761 // Load "pre-init" plugin modules
6763 {
6764 return false;
6765 }
6766 }
6767
6769
6770 // after the above has run we now have the REQUIRED set of engine .INIs (all of the other .INIs)
6771 // that are gotten from .h files' config() are not requires and are dynamically loaded when the .u files are loaded
6772
6773#if !UE_BUILD_SHIPPING
6774 // Prompt the user for remote debugging?
6775 bool bPromptForRemoteDebug = false;
6776 GConfig->GetBool(TEXT("Engine.ErrorHandling"), TEXT("bPromptForRemoteDebugging"), bPromptForRemoteDebug, GEngineIni);
6777 bool bPromptForRemoteDebugOnEnsure = false;
6778 GConfig->GetBool(TEXT("Engine.ErrorHandling"), TEXT("bPromptForRemoteDebugOnEnsure"), bPromptForRemoteDebugOnEnsure, GEngineIni);
6779
6780 if (FParse::Param(FCommandLine::Get(), TEXT("PROMPTREMOTEDEBUG")))
6781 {
6782 bPromptForRemoteDebug = true;
6783 }
6784
6785 if (FParse::Param(FCommandLine::Get(), TEXT("PROMPTREMOTEDEBUGENSURE")))
6786 {
6787 bPromptForRemoteDebug = true;
6788 bPromptForRemoteDebugOnEnsure = true;
6789 }
6790
6792 FPlatformMisc::SetShouldPromptForRemoteDebugOnEnsure(bPromptForRemoteDebugOnEnsure);
6793
6794 // Feedback context.
6795 if (FParse::Param(FCommandLine::Get(), TEXT("WARNINGSASERRORS")))
6796 {
6798 }
6799
6800 if (FParse::Param(FCommandLine::Get(), TEXT("ERRORSASWARNINGS")))
6801 {
6803 }
6804
6805 if (FParse::Param(FCommandLine::Get(), TEXT("SILENT")))
6806 {
6807 GIsSilent = true;
6808 }
6809
6810 if (FParse::Param(FCommandLine::Get(), TEXT("RUNNINGUNATTENDEDSCRIPT")))
6811 {
6813 }
6814
6815#endif // !UE_BUILD_SHIPPING
6816
6817 // Print all initial startup logging
6819
6820 // if a logging build, clear out old log files. Avoid races when multiple processes are running at once.
6821#if !NO_LOGGING
6822 if (!FParse::Param(FCommandLine::Get(), TEXT("MULTIPROCESS")))
6823 {
6825 }
6826#endif
6827
6828#if !UE_BUILD_SHIPPING
6829 {
6830 SCOPED_BOOT_TIMING("FApp::InitializeSession");
6832 }
6833#endif
6834
6835#if PLATFORM_USE_PLATFORM_FILE_MANAGED_STORAGE_WRAPPER
6836 // Delay initialization of FPersistentStorageManager to a point where GConfig is initialized
6838#endif
6839
6840 // Checks.
6841 check(sizeof(uint8) == 1);
6842 check(sizeof(int8) == 1);
6843 check(sizeof(uint16) == 2);
6844 check(sizeof(uint32) == 4);
6845 check(sizeof(uint64) == 8);
6846 check(sizeof(ANSICHAR) == 1);
6847
6848#if PLATFORM_TCHAR_IS_4_BYTES
6849 check(sizeof(TCHAR) == 4);
6850#else
6851 check(sizeof(TCHAR) == 2);
6852#endif
6853
6854 check(sizeof(int16) == 2);
6855 check(sizeof(int32) == 4);
6856 check(sizeof(int64) == 8);
6857 check(sizeof(bool) == 1);
6858 check(sizeof(float) == 4);
6859 check(sizeof(double) == 8);
6860
6861 // Init list of common colors.
6863
6864 bool bForceSmokeTests = false;
6865 GConfig->GetBool(TEXT("AutomationTesting"), TEXT("bForceSmokeTests"), bForceSmokeTests, GEngineIni);
6866 bForceSmokeTests |= FParse::Param(FCommandLine::Get(), TEXT("bForceSmokeTests"));
6868
6870
6871 // Init other systems.
6872 {
6873 SCOPED_BOOT_TIMING("FCoreDelegates::OnInit");
6874 FCoreDelegates::OnInit.Broadcast();
6875 }
6876
6877#if WITH_EDITOR
6878 if (FPIEPreviewDeviceModule::IsRequestingPreviewDevice())
6879 {
6880 FPIEPreviewDeviceModule* PIEPreviewDeviceProfileSelectorModule = FModuleManager::LoadModulePtr<FPIEPreviewDeviceModule>("PIEPreviewDeviceProfileSelector");
6882 {
6883 Scalability::ChangeScalabilityPreviewPlatform(PIEPreviewDeviceProfileSelectorModule->GetPreviewPlatformName(), GShaderPlatformForFeatureLevel[ERHIFeatureLevel::ES3_1]);
6884 }
6885 }
6886#endif
6887
6889
6890 return true;
6891}
6892
6894{
6895 SCOPED_BOOT_TIMING("AppPreExit");
6896
6897 UE_LOG(LogExit, Log, TEXT("Preparing to exit.") );
6898
6899 {
6900 SCOPED_NAMED_EVENT_TEXT("FCoreDelegates::OnPreExit", CoreDelegatesColor);
6901 FCoreDelegates::OnPreExit.Broadcast();
6902 }
6903
6904#if WITH_ENGINE
6905 if (FString(FCommandLine::Get()).Contains(TEXT("CreatePak")) && GetDerivedDataCache())
6906 {
6907 // if we are creating a Pak, we need to make sure everything is done and written before we exit
6908 UE_LOG(LogInit, Display, TEXT("Closing DDC Pak File."));
6909 GetDerivedDataCacheRef().WaitForQuiescence(true);
6910 }
6911#endif
6912
6913#if WITH_EDITOR
6915#endif
6916
6917 {
6918 SCOPED_NAMED_EVENT_TEXT("FCoreDelegates::OnExit", CoreDelegatesColor);
6919 FCoreDelegates::OnExit.Broadcast();
6920 }
6921
6922 // FGenericRHIGPUFence uses GFrameNumberRenderThread to tell when a frame is finished. If such an object is added in the last frame before we
6923 // exit, it will never be "signaled", since nothing ever increments GFrameNumberRenderThread again. This can lead to deadlocks in code
6924 // which uses async tasks to wait until resources are safe to be deleted (for example, FMediaTextureResource).
6925 // To avoid this, we set the frame number to the maximum possible value here, before waiting for the thread pool to die. It's safe to do so
6926 // because FlushRenderingCommands() is called multiple times on exit before reaching this point, so there's no way the render thread has any
6927 // more frames in flight.
6929
6930 if (GIOThreadPool != nullptr)
6931 {
6933 }
6934
6935#if (WITH_VERSE_VM || defined(__INTELLISENSE__)) && WITH_COREUOBJECT
6936 Verse::VerseVM::Shutdown();
6937#endif
6938
6939#if WITH_ENGINE
6941 {
6943 GShaderCompilingManager = nullptr;
6944 }
6946 {
6947 delete GShaderCompilerStats;
6948 GShaderCompilerStats = nullptr;
6949 }
6950
6951#if WITH_ODSC
6952 if (GODSCManager)
6953 {
6954 delete GODSCManager;
6955 GODSCManager = nullptr;
6956 }
6957#endif
6958
6959#else
6960#if WITH_COREUOBJECT
6961 // Shutdown the PackageResourceManager in AppPreExit for programs that do not call FEngineLoop::Exit
6963#endif
6964#endif
6965
6966}
6967
6968
6970{
6971 static bool bCalledOnce;
6972 if (bCalledOnce)
6973 {
6974 return;
6975 }
6976 bCalledOnce = true;
6977
6978 // when compiled WITH_ENGINE, this will happen in FEngineLoop::Exit()
6979#if !WITH_ENGINE
6980#if STATS
6981 FThreadStats::StopThread();
6982#endif
6984#endif // WITH_ENGINE
6985
6986 UE_LOG(LogExit, Log, TEXT("Exiting."));
6987
6988#if WITH_APPLICATION_CORE
6990#endif
6992
6993 if (GConfig)
6994 {
6995 GConfig->Exit();
6996 delete GConfig;
6997 GConfig = nullptr;
6998 }
6999
7000 if( GLog )
7001 {
7002 GLog->TearDown();
7003 }
7004
7007
7009}
7010
7012{
7013#if WITH_ENGINE
7016 for (int i = 0; i < PF_MAX; i++)
7017 {
7019 }
7021
7022 if (FApp::CanEverRender())
7023 {
7024 // perform an early check of hardware capabilities
7025 EShaderPlatform ShaderPlatform = GMaxRHIShaderPlatform;
7026
7027 const UE::StereoRenderUtils::FStereoShaderAspects Aspects(ShaderPlatform);
7028
7030 UE::StereoRenderUtils::VerifyISRConfig(Aspects, ShaderPlatform);
7031
7032 // Initialize system textures
7033 ENQUEUE_RENDER_COMMAND(InitializeSystemTextures)([](FRHICommandListImmediate& RHICmdList)
7034 {
7036 });
7037 }
7038
7039#endif
7040}
7041
7043{
7044#if WITH_ENGINE && !UE_SERVER
7045 if (!FParse::Param(FCommandLine::Get(), TEXT("nohmd")) && !FParse::Param(FCommandLine::Get(), TEXT("emulatestereo")))
7046 {
7047 // Get a list of modules that implement this feature
7051
7052 // Check whether the user passed in an explicit HMD module on the command line
7053 FString ExplicitHMDName;
7055
7056 // Iterate over modules, checking ExplicitHMDName and calling PreInit
7057 for (auto HMDModuleIt = HMDModules.CreateIterator(); HMDModuleIt; ++HMDModuleIt)
7058 {
7060
7061
7062 bool bUnregisterHMDModule = false;
7064 {
7066 HMDModule->GetModuleAliases(HMDAliases);
7067 HMDAliases.Add(HMDModule->GetModuleKeyName());
7068
7069 bUnregisterHMDModule = true;
7070 for (const FString& HMDModuleName : HMDAliases)
7071 {
7073 {
7074 bUnregisterHMDModule = !HMDModule->PreInit();
7075 break;
7076 }
7077 }
7078 }
7079 else
7080 {
7081 bUnregisterHMDModule = !HMDModule->PreInit();
7082 }
7083
7085 {
7086 // Unregister modules which don't match ExplicitHMDName, or which fail PreInit
7087 ModularFeatures.UnregisterModularFeature(Type, HMDModule);
7088 }
7089 }
7090 // Note we do not disable or warn here if no HMD modules matched ExplicitHMDName, as not all HMD plugins have been loaded yet.
7091 }
7092#endif // #if WITH_ENGINE && !UE_SERVER
7093}
7094
7096{
7097#if WITH_ENGINE && !UE_SERVER
7098 SlateRenderer = nullptr;
7099#endif // WITH_ENGINE && !UE_SERVER
7100
7101 delete SlowTaskPtr;
7102 SlowTaskPtr = nullptr;
7103}
7104
7105#undef LOCTEXT_NAMESPACE
OODEFFUNC typedef void(OODLE_CALLBACK t_fp_OodleCore_Plugin_Free)(void *ptr)
#define FORCEINLINE
Definition AndroidPlatform.h:140
#define check(expr)
Definition AssertionMacros.h:314
#define ensureMsgf( InExpression, InFormat,...)
Definition AssertionMacros.h:465
#define ensure( InExpression)
Definition AssertionMacros.h:464
#define checkf(expr, format,...)
Definition AssertionMacros.h:315
#define verify(expr)
Definition AssertionMacros.h:319
void CancelAsyncLoading()
Definition AsyncPackageLoader.cpp:716
void ResetAsyncLoadingStats()
Definition AsyncPackageLoader.cpp:784
void NotifyRegistrationComplete()
Definition AsyncPackageLoader.cpp:765
void FlushAsyncLoading(int32 RequestId)
Definition AsyncPackageLoader.cpp:313
void SetAsyncLoadingAllowed(bool bAllowAsyncLoading)
Definition AsyncPackageLoader.cpp:211
#define IS_PROGRAM
Definition Build.h:142
ENGINE_API class UEngine * GEngine
Definition UnrealEngine.cpp:427
FColorList GColorList
Definition ColorList.cpp:17
bool bSuccess
Definition ConvexDecomposition3.cpp:819
CORE_API bool GIgnoreDebugger
Definition CoreGlobals.cpp:487
bool GIsClient
Definition CoreGlobals.cpp:215
CORE_API void SetEngineStartupModuleLoadingComplete()
Definition CoreGlobals.cpp:309
FString GEditorSettingsIni
Definition CoreGlobals.cpp:243
bool GIsSilent
Definition CoreGlobals.cpp:224
bool GAreScreenMessagesEnabled
Definition CoreGlobals.cpp:229
TCHAR GErrorHist[16384]
Definition CoreGlobals.cpp:68
FString GGameUserSettingsIni
Definition CoreGlobals.cpp:254
FString GEngineIni
Definition CoreGlobals.cpp:237
int32 GCycleStatsShouldEmitNamedEvents
Definition CoreGlobals.cpp:462
bool GIsGameThreadIdInitialized
Definition CoreGlobals.cpp:442
FConfigCacheIni * GConfig
Definition CoreGlobals.cpp:54
CORE_API FFeedbackContext * GWarn
Definition CoreGlobals.cpp:53
uint64 GFrameCounterRenderThread
Definition CoreGlobals.cpp:419
uint64 GFrameCounter
Definition CoreGlobals.cpp:418
bool GIsServer
Definition CoreGlobals.cpp:216
uint64 GInputTime
Definition CoreGlobals.cpp:423
int32 GIsDumpingMovie
Definition CoreGlobals.cpp:231
FString GEditorPerProjectIni
Definition CoreGlobals.cpp:246
bool GIsDemoMode
Definition CoreGlobals.cpp:471
void CORE_API RequestEngineExit(const TCHAR *ReasonString)
Definition CoreGlobals.cpp:332
bool GShouldEmitVerboseNamedEvents
Definition CoreGlobals.cpp:468
FString GEditorIni
Definition CoreGlobals.cpp:240
void CORE_API SetEmitDrawEvents(bool EmitDrawEvents)
Definition CoreGlobals.cpp:496
FOutputDeviceConsole * GLogConsole
Definition CoreGlobals.cpp:56
void CORE_API BeginExitIfRequested()
Definition CoreGlobals.cpp:322
uint32 GGameThreadId
Definition CoreGlobals.cpp:437
PRAGMA_ENABLE_DEPRECATION_WARNINGS bool GIsGameAgnosticExe
Definition CoreGlobals.cpp:135
FUELibraryOverrideSettings GUELibraryOverrideSettings
Definition CoreGlobals.cpp:174
FString GSystemStartTime
Definition CoreGlobals.cpp:411
FString GGameIni
Definition CoreGlobals.cpp:253
bool GIsRunningUnattendedScript
Definition CoreGlobals.cpp:181
bool GIsBuildMachine
Definition CoreGlobals.cpp:222
bool GIsPlayInEditorWorld
Definition CoreGlobals.cpp:403
FString GInputIni
Definition CoreGlobals.cpp:252
uint32 GFrameNumberRenderThread
Definition CoreGlobals.cpp:427
FORCEINLINE bool IsRunningCommandlet()
Definition CoreGlobals.h:247
#define UE_SCOPED_ENGINE_ACTIVITY(Fmt,...)
Definition CoreGlobals.h:92
#define SCOPED_BOOT_TIMING(x)
Definition CoreGlobals.h:91
FORCEINLINE bool IsRunningCookCommandlet()
Definition CoreGlobals.h:259
FORCEINLINE bool IsEngineExitRequested()
Definition CoreGlobals.h:408
#define GLog
Definition CoreGlobals.h:95
#define GIsEditor
Definition CoreGlobals.h:233
@ INDEX_NONE
Definition CoreMiscDefines.h:150
FDerivedDataCacheInterface * GetDerivedDataCache()
Definition CoreMisc.cpp:125
FDerivedDataCacheInterface & GetDerivedDataCacheRef()
Definition CoreMisc.cpp:144
class ITargetPlatformManagerModule * GetTargetPlatformManager(bool bFailOnInitErrors)
Definition CoreMisc.cpp:167
void SetIsServerForOnlineSubsystemsDelegate(FQueryIsRunningServer NewDelegate)
Definition CoreMisc.cpp:242
bool IsRunningDedicatedServer()
Definition CoreMisc.h:152
FPlatformTypes::int16 int16
A 16-bit signed integer.
Definition Platform.h:1123
FPlatformTypes::int8 int8
An 8-bit signed integer.
Definition Platform.h:1121
#define LINE_TERMINATOR
Definition Platform.h:902
#define TEXT(x)
Definition Platform.h:1272
#define LINE_TERMINATOR_ANSI
Definition Platform.h:905
FPlatformTypes::TCHAR TCHAR
Either ANSICHAR or WIDECHAR, depending on whether the platform supports wide characters or the requir...
Definition Platform.h:1135
FPlatformTypes::int64 int64
A 64-bit signed integer.
Definition Platform.h:1127
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
FPlatformTypes::UTF8CHAR UTF8CHAR
An 8-bit character containing a UTF8 (Unicode, 8-bit, variable-width) code unit.
Definition Platform.h:1137
FPlatformTypes::ANSICHAR ANSICHAR
An ANSI character. Normally a signed type.
Definition Platform.h:1131
FPlatformTypes::uint64 uint64
A 64-bit unsigned integer.
Definition Platform.h:1117
#define SET_DWORD_STAT(StatId, Value)
Definition Stats.h:707
#define GET_STATID(Stat)
Definition Stats.h:656
#define DECLARE_CYCLE_STAT(CounterName, StatId, GroupId)
Definition Stats.h:669
#define SCOPE_CYCLE_COUNTER(Stat)
Definition Stats.h:650
#define RETURN_QUICK_DECLARE_CYCLE_STAT(StatId, GroupId)
Definition Stats.h:655
#define STAT_ADD_CUSTOMMESSAGE_NAME(StatId, Value)
Definition Stats.h:709
#define DECLARE_SCOPE_CYCLE_COUNTER(CounterName, StatId, GroupId)
Definition Stats.h:653
#define SET_FLOAT_STAT(StatId, Value)
Definition Stats.h:708
SharedPointerInternals::TRawPtrProxy< ObjectType > MakeShareable(ObjectType *InObject)
Definition SharedPointer.h:1947
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
#define TRACE_CPUPROFILER_EVENT_SCOPE(Name)
Definition CpuProfilerTrace.h:528
#define TRACE_CPUPROFILER_EVENT_SCOPE_TEXT(Name)
Definition CpuProfilerTrace.h:532
UE::FPlatformRecursiveMutex FCriticalSection
Definition CriticalSection.h:53
#define CSV_CUSTOM_STAT_MINIMAL_GLOBAL(StatName, Value, Op)
Definition CsvProfiler.h:86
#define CSV_DEFINE_CATEGORY(CategoryName, bDefaultValue)
Definition CsvProfiler.h:77
#define CSV_CUSTOM_STAT(Category, StatName, Value, Op)
Definition CsvProfiler.h:160
#define CSV_CUSTOM_STAT_GLOBAL(StatName, Value, Op)
Definition CsvProfiler.h:161
#define CSV_EVENT_GLOBAL(Format,...)
Definition CsvProfiler.h:82
#define CSV_SCOPED_SET_WAIT_STAT(StatName)
Definition CsvProfiler.h:158
#define CSV_SCOPED_TIMING_STAT_EXCLUSIVE(StatName)
Definition CsvProfiler.h:152
#define CSV_METADATA(Key, Value)
Definition CsvProfiler.h:83
#define CSV_DECLARE_CATEGORY_MODULE_EXTERN(Module_API, CategoryName)
Definition CsvProfiler.h:80
bool IsFeatureLevelSupported(const FStaticShaderPlatform InShaderPlatform, ERHIFeatureLevel::Type InFeatureLevel)
Definition DataDrivenShaderPlatformInfo.h:1047
DIRECTLINK_API Display
Definition DirectLinkLog.h:8
FDistanceFieldAsyncQueue * GDistanceFieldAsyncQueue
Definition DistanceFieldAtlas.cpp:133
void RHIPostInit(const TArray< uint32 > &InPixelFormatByteWidth)
Definition DynamicRHI.cpp:419
void RHIInit(bool bHasEditorToken)
Definition DynamicRHI.cpp:278
void RHIExit()
Definition DynamicRHI.cpp:432
RHIGetGPUUsageType RHIGetGPUUsage
Definition DynamicRHI.cpp:36
void RHITick(float DeltaTime)
Definition DynamicRHI.h:1331
ENetMode
Definition EngineBaseTypes.h:937
@ NM_DedicatedServer
Definition EngineBaseTypes.h:942
@ NM_Standalone
Definition EngineBaseTypes.h:939
@ NM_ListenServer
Definition EngineBaseTypes.h:945
ENGINE_API IRendererModule & GetRendererModule()
Definition EngineGlobals.cpp:63
CORE_API TCHAR MiniDumpFilenameW[1024]
Definition ExceptionHandling.cpp:26
@ FILEWRITE_NoFail
Definition FileManager.h:17
RHI_API uint32 RHIGetGPUFrameCycles(uint32 GPUIndex)
Definition GPUProfiler.cpp:2722
@ TPri_AboveNormal
Definition GenericPlatformAffinity.h:28
@ TPri_Lowest
Definition GenericPlatformAffinity.h:31
#define PRAGMA_ENABLE_DEPRECATION_WARNINGS
Definition GenericPlatformCompilerPreSetup.h:12
#define PRAGMA_DISABLE_DEPRECATION_WARNINGS
Definition GenericPlatformCompilerPreSetup.h:8
FHighResScreenshotConfig & GetHighResScreenshotConfig()
Definition HighResScreenshot.cpp:36
const TCHAR * LexToString(EAnalyticsRecordEventMode Mode)
Definition IAnalyticsProvider.cpp:5
@ ECVF_Default
Definition IConsoleManager.h:61
@ ECVF_SetBySystemSettingsIni
Definition IConsoleManager.h:155
@ ECVF_SetByProjectSetting
Definition IConsoleManager.h:153
@ ECVF_SetByCommandline
Definition IConsoleManager.h:171
#define LOCTEXT(InKey, InTextLiteral)
Definition Internationalization.h:295
#define NSLOCTEXT(InNamespace, InKey, InTextLiteral)
Definition Internationalization.h:300
void RecordFileReadsFromPaks()
Definition LaunchEngineLoop.cpp:1321
TUniquePtr< FFileInPakFileHistoryHelper > FileInPakFileHistoryHelper
Definition LaunchEngineLoop.cpp:1318
void LaunchCheckForCommandLineAliases(const FConfigFile &Config, TArray< FString > &PrevExpansions, bool &bChanged)
Definition LaunchEngineLoop.cpp:1012
void DumpEarlyReads(bool bDumpEarlyConfigReads, bool bDumpEarlyPakFileReads, bool bForceQuitAfterEarlyReads)
void ConditionallyEnsureOnCommandletErrors(int32 InNumErrors)
Definition LaunchEngineLoop.cpp:3377
void LaunchCheckForCmdLineFile(TArray< FString > &PrevExpansions, bool &bChanged)
Definition LaunchEngineLoop.cpp:1064
void DumpRecordedFileReadsFromPaks()
Definition LaunchEngineLoop.cpp:1328
void LaunchFixProjectPathCase()
Definition LaunchEngineLoop.cpp:750
void InitializeStdOutDevice()
Definition LaunchEngineLoop.cpp:566
EGameStringType
Definition LaunchEngineLoop.cpp:1616
bool LaunchCheckForFileOverride(const TCHAR *CmdLine, bool &OutFileOverrideFound)
Definition LaunchEngineLoop.cpp:841
void DeleteRecordedFileReadsFromPaks()
Definition LaunchEngineLoop.cpp:1338
bool LaunchHasIncompleteGameName()
Definition LaunchEngineLoop.cpp:1176
bool LaunchSetGameName(const TCHAR *InCmdLine, FString &OutGameProjectFilePathUnnormalized)
Definition LaunchEngineLoop.cpp:643
bool GIsConsoleExecutable
Definition LaunchEngineLoop.cpp:328
void HandleConfigReload(bool bReloadConfig)
bool ParseGameProjectFromCommandLine(const TCHAR *InCmdLine, FString &OutProjectFilePath, FString &OutGameName)
Definition LaunchEngineLoop.cpp:576
void LaunchFixGameNameCase()
Definition LaunchEngineLoop.cpp:760
void LaunchUpdateMostRecentProjectFile()
Definition LaunchEngineLoop.cpp:1197
FAutoConsoleVariableSink CVarLogSink(FConsoleCommandDelegate::CreateStatic(&CVarLogSinkFunction))
FEngineLoop GEngineLoop
Definition LaunchIOS.cpp:39
FEngineLoop GEngineLoop
Definition LaunchIOS.cpp:39
bool ProcessCommandLine()
Definition LaunchWindows.cpp:147
int32 GAllowCookedDataInEditorBuilds
Definition LinkerLoad.cpp:171
void DeleteLoaders()
Definition Linker.cpp:918
void Init()
Definition LockFreeList.h:4
#define UE_CLOG(Condition, CategoryName, Verbosity, Format,...)
Definition LogMacros.h:298
#define UE_LOG(CategoryName, Verbosity, Format,...)
Definition LogMacros.h:270
void MeasureLongGPUTaskExecutionTime(FRHICommandListImmediate &RHICmdList)
Definition LongGPUTask.cpp:69
void IssueScalableLongGPUTask(FRHICommandListImmediate &RHICmdList, int32 NumIteration)
Definition LongGPUTask.cpp:20
#define LLM_SCOPE_BYNAME(...)
Definition LowLevelMemTracker.h:1098
#define LLM(...)
Definition LowLevelMemTracker.h:1092
#define LLM_SCOPE(...)
Definition LowLevelMemTracker.h:1095
CORE_API bool GMallocFrameProfilerEnabled
Definition MallocFrameProfiler.cpp:21
FCardRepresentationAsyncQueue * GCardRepresentationAsyncQueue
Definition MeshCardRepresentation.cpp:167
#define TRACE_BEGIN_FRAME(...)
Definition MiscTrace.h:217
#define TRACE_END_FRAME(...)
Definition MiscTrace.h:218
@ TraceFrameType_Game
Definition MiscTrace.h:29
@ TraceFrameType_Rendering
Definition MiscTrace.h:30
#define TRACE_BOOKMARK(...)
Definition MiscTrace.h:194
IGameMoviePlayer * GetMoviePlayer()
Definition MoviePlayer.cpp:106
bool IsMoviePlayerEnabled()
Definition MoviePlayer.cpp:123
void CreateMoviePlayer()
Definition MoviePlayer.cpp:71
void DestroyMoviePlayer()
Definition MoviePlayer.cpp:87
#define GNumExplicitGPUsForRendering
Definition MultiGPU.h:26
#define MAX_uint32
Definition NumericLimits.h:21
FODSCManager * GODSCManager
Definition ODSCManager.cpp:47
UPackage * GetTransientPackage()
Definition Obj.cpp:5819
CORE_API FOutputDeviceError * GError
Definition OutputDevice.cpp:92
#define CLEAR_WARN_COLOR()
Definition OutputDevice.h:30
#define SET_WARN_COLOR(Color)
Definition OutputDevice.h:28
void ClearMaterialPSORequests()
Definition PSOPrecacheMaterial.cpp:744
void TermGamePhys()
Definition PhysLevel.cpp:347
bool InitGamePhys()
Definition PhysLevel.cpp:316
void DeferredPhysResourceCleanup()
Definition PhysLevel.cpp:370
FPixelFormatInfo GPixelFormats[PF_MAX]
Definition PixelFormat.cpp:31
@ PF_MAX
Definition PixelFormat.h:111
#define SCOPED_NAMED_EVENT_TEXT(Text, Color)
Definition PlatformMisc.h:192
#define SCOPED_NAMED_EVENT_TCHAR_CONDITIONAL(Text, Color, bCondition)
Definition PlatformMisc.h:200
#define SCOPED_NAMED_EVENT(Name, Color)
Definition PlatformMisc.h:180
#define RHI_BREADCRUMB_FIELD( ...)
Definition RHIBreadcrumbs.h:1427
uint64 GInputLatencyTime
Definition RHICommandList.cpp:117
bool IsRunningRHIInSeparateThread()
Definition RHICommandList.h:159
#define GTriggerGPUHitchProfile
Definition RHIGlobals.h:845
#define GUsingNullRHI
Definition RHIGlobals.h:840
#define GRHISupportsGPUUsage
Definition RHIGlobals.h:785
#define GShaderPlatformForFeatureLevel
Definition RHIGlobals.h:915
#define GTriggerGPUProfile
Definition RHIGlobals.h:844
EShaderPlatform
Definition RHIShaderPlatform.h:11
ERHIFeatureLevel::Type GMaxRHIFeatureLevel
Definition RHI.cpp:1338
EShaderPlatform GMaxRHIShaderPlatform
Definition RHI.cpp:1335
#define GPU_STATS_BEGINFRAME(RHICmdList)
Definition RealtimeGPUProfiler.h:267
#define GPU_STATS_ENDFRAME(RHICmdList)
Definition RealtimeGPUProfiler.h:268
RENDERCORE_API void RenderUtilsInit()
Definition RenderUtils.cpp:781
uint32 GRenderThreadTime
Definition RenderingThread.cpp:151
RENDERCORE_API bool GUseThreadedRendering
Definition RenderingThread.cpp:49
uint32 GGameThreadTimeCriticalPath
Definition RenderingThread.cpp:1077
RENDERCORE_API void ShutdownRenderingThread()
Definition RenderingThread.cpp:809
void FlushRenderingCommands()
Definition RenderingThread.cpp:1272
uint32 GRHIThreadTime
Definition RenderingThread.cpp:155
void StopRenderCommandFenceBundler()
Definition RenderingThread.cpp:919
uint32 GGameThreadTime
Definition RenderingThread.cpp:1071
FPendingCleanupObjects * GetPendingCleanupObjects()
Definition RenderingThread.cpp:1429
void StartRenderCommandFenceBundler()
Definition RenderingThread.cpp:874
RENDERCORE_API void LatchRenderThreadConfiguration()
Definition RenderingThread.cpp:763
uint32 GRenderThreadTimeCriticalPath
Definition RenderingThread.cpp:157
RENDERCORE_API void InitRenderingThread()
Definition RenderingThread.cpp:795
void AdvanceRenderingThreadStatsGT(bool bDiscardCallstack, int64 StatsFrame, int32 DisableChangeTagStartFrame)
Definition RenderingThread.cpp:308
#define ENQUEUE_RENDER_COMMAND(Type)
Definition RenderingThread.h:1167
#define ON_SCOPE_EXIT
Definition ScopeExit.h:73
bool ShouldCompileODSCOnlyShaders()
Definition ShaderCompilerJobCache.cpp:188
FShaderCompilerStats * GShaderCompilerStats
Definition ShaderCompilerStats.cpp:51
void CompileGlobalShaderMap(EShaderPlatform Platform, const ITargetPlatform *TargetPlatform, bool bRefreshShaderMap)
Definition ShaderCompiler.cpp:5315
FShaderCompilingManager * GShaderCompilingManager
Definition ShaderCompiler.cpp:617
void ShutdownGlobalShaderMap()
Definition ShaderCompiler.cpp:5538
void PrecacheComputePipelineStatesForGlobalShaders(ERHIFeatureLevel::Type FeatureLevel, const ITargetPlatform *TargetPlatform)
Definition ShaderCompiler.cpp:4932
bool AllowShaderCompiling()
Definition ShaderCore.cpp:1020
void InitializeShaderTypes()
Definition ShaderCore.cpp:3523
void InitializeShaderHashCache()
Definition ShaderCore.cpp:3500
const TMap< FString, FString > & AllShaderSourceDirectoryMappings()
Definition ShaderCore.cpp:4060
bool AllowGlobalShaderLoad()
Definition ShaderCore.cpp:1038
void AddShaderSourceDirectoryMapping(const FString &VirtualShaderDirectory, const FString &RealShaderDirectory)
Definition ShaderCore.cpp:4070
EShaderPermutationFlags
Definition ShaderPermutation.h:19
void SetAdditionalShaderPermutationFlags(EShaderPermutationFlags AdditionalFlags)
Definition Shader.cpp:2928
USkinnedMeshComponent float
Definition SkinnedMeshComponent.h:60
ESlateTickType
Definition SlateApplication.h:168
#define SCOPE_STALL_COUNTER(InName, InBudgetSeconds)
Definition StallDetector.h:64
#define TEXTVIEW(str)
Definition StringView.h:553
FSystemSettings GSystemSettings
Definition SystemSettings.cpp:26
void InitEngineTextLocalization()
Definition TextLocalizationManager.cpp:507
void BeginPreInitTextLocalization()
Definition TextLocalizationManager.cpp:483
void BeginInitTextLocalization()
Definition TextLocalizationManager.cpp:494
void InitGameTextLocalization()
Definition TextLocalizationManager.cpp:561
FQueuedThreadPool * GBackgroundPriorityThreadPool
Definition ThreadingBase.cpp:52
FQueuedThreadPool * GThreadPool
Definition ThreadingBase.cpp:48
CORE_API bool IsInGameThread()
Definition ThreadingBase.cpp:185
FQueuedThreadPool * GIOThreadPool
Definition ThreadingBase.cpp:50
void TickRenderingTickables()
Definition TickableObjectRenderThread.cpp:64
#define SCOPE_TIME_GUARD(name)
Definition TimeGuard.h:166
#define UE_TRACE_CHANNELEXPR_IS_ENABLED(ChannelsExpr)
Definition Trace.h:452
#define UE_TRACE_LOG_SCOPED_T(LoggerName, EventName, ChannelsExpr,...)
Definition Trace.h:442
#define UE_TRACE_EVENT_BEGIN(LoggerName, EventName,...)
Definition Trace.h:434
#define UE_TRACE_EVENT_END()
Definition Trace.h:438
#define UE_TRACE_EVENT_FIELD(FieldType, FieldName)
Definition Trace.h:436
constexpr uint32 HashCombine(uint32 A, uint32 C)
Definition TypeHash.h:36
void ProcessNewlyLoadedUObjects(FName InModuleName, bool bCanProcessNewlyLoadedObjects)
Definition UObjectBase.cpp:1027
void RegisterModularObjectsProcessing()
Definition UObjectBase.cpp:1011
UObject * StaticFindFirstObject(UClass *Class, FStringView Name, EFindFirstObjectOptions Options, ELogVerbosity::Type AmbiguousMessageVerbosity, const TCHAR *InCurrentOperation)
Definition UObjectGlobals.cpp:669
UClass * StaticLoadClass(UClass *BaseClass, UObject *InOuter, FStringView InName, FStringView Filename, uint32 LoadFlags, UPackageMap *Sandbox)
Definition UObjectGlobals.cpp:1439
FUObjectArray GUObjectArray
Definition UObjectHash.cpp:55
ENGINE_API void InitializeRenderingCVarsCaching()
Definition UnrealEngine.cpp:1188
void CalculateFPSTimings()
Definition UnrealEngine.cpp:741
UE_INTRINSIC_CAST UE_REWRITE constexpr std::remove_reference_t< T > && MoveTemp(T &&Obj) noexcept
Definition UnrealTemplate.h:520
TGlobalResource< FVisualizeTexture > GVisualizeTexture
Definition VisualizeTexture.cpp:327
ENGINE_API float GNewWorldToMetersScale
Definition WorldSettings.cpp:51
ENGINE_API class UWorldProxy GWorld
Definition World.cpp:749
TArray< TWeakObjectPtr< APlayerController > >::TConstIterator FConstPlayerControllerIterator
Definition World.h:91
if(Failed) console_printf("Failed.\n")
uint8_t uint8
Definition binka_ue_file_header.h:8
uint16_t uint16
Definition binka_ue_file_header.h:7
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition PlayerController.h:261
TObjectPtr< UPlayer > Player
Definition PlayerController.h:270
static const uint64 GetMainGameMask()
Definition AndroidPlatformAffinity.h:18
Definition AppMediaTimeSource.h:14
static FORCEINLINE double GetDeltaTime()
Definition App.h:639
static FORCEINLINE const TCHAR * GetProjectName()
Definition App.h:126
static void SetUseFixedTimeStep(bool bVal)
Definition App.h:592
static FORCEINLINE bool IsProjectNameEmpty()
Definition App.h:189
static CORE_API void InitializeSession()
Definition App.cpp:185
static CORE_API bool IsInstalled()
Definition App.cpp:222
static FORCEINLINE bool IsGame()
Definition App.h:175
static FORCEINLINE void SetProjectName(const TCHAR *InProjectName)
Definition App.h:199
static CORE_API bool bUseFixedSeed
Definition App.h:847
static CORE_API bool ShouldUseThreadingForPerformance()
Definition App.cpp:300
static void SetFixedDeltaTime(double Seconds)
Definition App.h:568
static FORCEINLINE double GetFixedDeltaTime()
Definition App.h:558
static FString GetName()
Definition App.h:137
static FORCEINLINE bool HasProjectName()
Definition App.h:161
static CORE_API bool HasFocus()
Definition App.cpp:373
static FORCEINLINE bool IsBenchmarking()
Definition App.h:538
static CORE_API bool IsUnattended()
Definition App.cpp:284
static CORE_API void PrintStartupLogMessages()
Definition App.cpp:397
static void SetCurrentTime(double Seconds)
Definition App.h:612
static CORE_API EBuildConfiguration GetBuildConfiguration()
Definition App.cpp:127
static void SetBenchmarking(bool bVal)
Definition App.h:548
static INLINE_CANEVERRENDER bool CanEverRender()
Definition App.h:411
Definition AppleAsyncTask.cpp:6
Definition Archive.h:1208
virtual void Serialize(void *V, int64 Length)
Definition Archive.h:1689
ENGINE_API void ProcessAsyncTasks(bool bLimitExecutionTime=false)
Definition AssetCompilingManager.cpp:806
ENGINE_API void Shutdown()
Definition AssetCompilingManager.cpp:785
static ENGINE_API FAssetCompilingManager & Get()
Definition AssetCompilingManager.cpp:800
static ENGINE_API void Shutdown()
Definition AudioDeviceManager.cpp:765
static ENGINE_API void SetUseThreadedAudio(bool bInUseThreadedAudio)
Definition AudioThread.cpp:385
Definition IConsoleManager.h:2026
Definition TaskGraphInterfaces.h:213
ENamedThreads::Type Get(ENamedThreads::Type Thread=ENamedThreads::AnyThread)
Definition TaskGraphInterfaces.h:228
Definition IConsoleManager.h:1397
Definition CoreMisc.h:326
CORE_API void Update(bool bIsProfiling)
Definition CoreMisc.cpp:534
CORE_API bool RunSmokeTests()
Definition AutomationTest.cpp:526
void SetForceSmokeTests(const bool bInForceSmokeTests)
Definition AutomationTest.h:1231
static CORE_API FAutomationTestFramework & Get()
Definition AutomationTest.cpp:325
Definition MeshCardBuild.h:250
CORE_API void CreateColorMap()
Definition ColorList.cpp:82
static CORE_API bool LoadExternalIniFile(FConfigFile &ConfigFile, const TCHAR *IniName, const TCHAR *EngineConfigDir, const TCHAR *SourceConfigDir, bool bIsBaseIniName, const TCHAR *Platform=NULL, bool bForceReload=false, bool bWriteDestIni=false, bool bAllowGeneratedIniWhenCooked=true, const TCHAR *GeneratedConfigDir= *FPaths::GeneratedConfigDir())
Definition ConfigCacheIni.cpp:6579
CORE_API bool GetBool(const TCHAR *Section, const TCHAR *Key, bool &Value, const FString &Filename)
Definition ConfigCacheIni.cpp:5154
static CORE_API void InitializeConfigSystem()
Definition ConfigCacheIni.cpp:6411
static CORE_API void LoadConsoleVariablesFromINI()
Definition ConfigCacheIni.cpp:6633
CORE_API void Exit()
Definition ConfigCacheIni.cpp:4999
CORE_API bool GetInt(const TCHAR *Section, const TCHAR *Key, int32 &Value, const FString &Filename)
Definition ConfigCacheIni.cpp:5090
CORE_API void Detach(const FString &Filename)
Definition ConfigCacheIni.cpp:4642
CORE_API bool GetString(const TCHAR *Section, const TCHAR *Key, FString &Value, const FString &Filename)
Definition ConfigCacheIni.cpp:4649
Definition ConfigCacheIni.h:566
Definition ConfigCacheIni.h:407
static CORE_API TDelegate< void()> StarvedGameLoop
Definition CoreDelegates.h:275
static CORE_API TMulticastDelegate< void()> ApplicationHasReactivatedDelegate
Definition CoreDelegates.h:327
static CORE_API TMulticastDelegate< void(const FString &)> PakFileMountFailedDelegate
Definition CoreDelegates.h:158
static CORE_API FSimpleMulticastDelegate OnInit
Definition CoreDelegates.h:212
static CORE_API TTSMulticastDelegate< void(const TCHAR *PakFile, const TCHAR *FileName)> & GetOnFileOpenedForReadFromPakFile()
Definition CoreDelegates.cpp:61
static CORE_API FSimpleMulticastDelegate OnEndFrameRT
Definition CoreDelegates.h:266
static CORE_API TMulticastDelegate< void()> ApplicationWillEnterBackgroundDelegate
Definition CoreDelegates.h:333
static CORE_API FSimpleMulticastDelegate OnExit
Definition CoreDelegates.h:233
static CORE_API TDelegate< int32(const TArray< FString > &)> OnMountAllPakFiles
Definition CoreDelegates.h:124
static CORE_API FSimpleMulticastDelegate OnEndFrame
Definition CoreDelegates.h:260
static CORE_API FSimpleMulticastDelegate OnCommandletPreMain
Definition CoreDelegates.h:227
static CORE_API TMulticastDelegate< void()> ApplicationHasEnteredForegroundDelegate
Definition CoreDelegates.h:336
static CORE_API FSimpleMulticastDelegate OnSamplingInput
Definition CoreDelegates.h:257
static CORE_API TMulticastDelegate< void()> ApplicationWillDeactivateDelegate
Definition CoreDelegates.h:324
static CORE_API FSimpleMulticastDelegate OnBeginFrame
Definition CoreDelegates.h:254
static CORE_API FSimpleMulticastDelegate OnPreExit
Definition CoreDelegates.h:236
static CORE_API FSimpleMulticastDelegate OnPostEngineInit
Definition CoreDelegates.h:218
static CORE_API FSimpleMulticastDelegate OnCommandletPostMain
Definition CoreDelegates.h:230
static CORE_API FSimpleMulticastDelegate OnFEngineLoopInitComplete
Definition CoreDelegates.h:224
static CORE_API FSimpleMulticastDelegate OnBeginFrameRT
Definition CoreDelegates.h:263
static CORE_API FSimpleMulticastDelegate OnOutputDevicesInit
Definition CoreDelegates.h:215
static void ResetNeedsUpdate()
Definition TextureResource.h:313
Definition IDelegateInstance.h:14
Definition DistanceFieldAtlas.h:349
static CORE_API void Init()
Definition EmbeddedCommunication.cpp:82
static CORE_API void ForceTick(int ID, float MinTimeSlice=0.1f, float MaxTimeSlice=0.5f)
Definition EmbeddedCommunication.cpp:93
static CORE_API bool IsAwakeForTicking()
Definition EmbeddedCommunication.cpp:285
static CORE_API void KeepAwake(FName Requester, bool bNeedsRendering)
Definition EmbeddedCommunication.cpp:158
static CORE_API void AllowSleep(FName Requester)
Definition EmbeddedCommunication.cpp:186
static ENGINE_API bool IsInitialized()
Definition EngineFontServices.cpp:42
static ENGINE_API void Destroy()
Definition EngineFontServices.cpp:35
static ENGINE_API void Create()
Definition EngineFontServices.cpp:29
static bool AppInit()
Definition LaunchEngineLoop.cpp:6409
FEngineLoop()
Definition LaunchEngineLoop.cpp:1351
void LoadPreInitModules()
Definition LaunchEngineLoop.cpp:4379
void OverrideProjectModule(const FString &InOriginalProjectModuleName, const FString &InReplacementProjectModuleName)
Definition LaunchEngineLoop.cpp:1361
static void AppExit()
Definition LaunchEngineLoop.cpp:6969
int32 PreInit(int32 ArgC, TCHAR *ArgV[], const TCHAR *AdditionalCommandline=nullptr)
Definition LaunchEngineLoop.cpp:1369
int32 PreInitPreStartupScreen(const TCHAR *CmdLine)
Definition LaunchEngineLoop.cpp:1699
bool LoadCoreModules()
Definition LaunchEngineLoop.cpp:4361
static void PreInitHMDDevice()
Definition LaunchEngineLoop.cpp:7042
uint64 MaxFrameCounter
Definition LaunchEngineLoop.h:172
double TotalTickTime
Definition LaunchEngineLoop.h:166
uint32 LastFrameCycles
Definition LaunchEngineLoop.h:175
static void AppPreExit()
Definition LaunchEngineLoop.cpp:6893
void CleanupPreInitContext()
Definition LaunchEngineLoop.cpp:4374
int32 PreInitPostStartupScreen(const TCHAR *CmdLine)
Definition LaunchEngineLoop.cpp:3387
static void PostInitRHI()
Definition LaunchEngineLoop.cpp:7011
double MaxTickTime
Definition LaunchEngineLoop.h:169
Definition EnginePackageLocalizationCache.h:12
Definition EngineService.h:20
static CORE_API const FEngineVersion & Current()
Definition EngineVersion.cpp:212
Definition Event.h:21
virtual void Trigger()=0
virtual CORE_API bool Exec(UWorld *InWorld, const TCHAR *Cmd, FOutputDevice &Ar)
Definition Exec.cpp:30
Definition LaunchEngineLoop.cpp:358
FExecuteConcurrentWithSlateTickTask(TFunction< void()> InTickWithSlate, FEvent *InCompleteEvent)
Definition LaunchEngineLoop.cpp:363
static FORCEINLINE ENamedThreads::Type GetDesiredThread()
Definition LaunchEngineLoop.cpp:375
void DoTask(ENamedThreads::Type CurrentThread, const FGraphEventRef &MyCompletionGraphEvent)
Definition LaunchEngineLoop.cpp:382
static FORCEINLINE ESubsequentsMode::Type GetSubsequentsMode()
Definition LaunchEngineLoop.cpp:380
static FORCEINLINE TStatId GetStatId()
Definition LaunchEngineLoop.cpp:370
Definition FeedbackContext.h:30
bool TreatWarningsAsErrors
Definition FeedbackContext.h:122
void GetErrors(TArray< FString > &OutErrors) const
Definition FeedbackContext.h:141
void GetWarnings(TArray< FString > &OutWarnings) const
Definition FeedbackContext.h:130
CORE_API void BeginSlowTask(const FText &Task, bool ShowProgressDialog, bool bShowCancelButton=false)
Definition FeedbackContext.cpp:210
bool TreatErrorsAsWarnings
Definition FeedbackContext.h:124
int32 GetNumErrors() const
Definition FeedbackContext.h:146
Definition LaunchEngineLoop.cpp:1238
friend uint32 GetTypeHash(const FFileInPakFileHistory &H)
Definition LaunchEngineLoop.cpp:1245
~FFileInPakFileHistoryHelper()
Definition LaunchEngineLoop.cpp:1273
friend bool operator==(const FFileInPakFileHistory &A, const FFileInPakFileHistory &B)
Definition LaunchEngineLoop.cpp:1251
FFileInPakFileHistoryHelper()
Definition LaunchEngineLoop.cpp:1268
void DumpHistory()
Definition LaunchEngineLoop.cpp:1278
static CORE_API FString DefaultConvertToRelativePath(const TCHAR *Filename)
Definition FileManagerGeneric.cpp:588
CORE_API void InitSettings()
Definition ThreadHeartBeat.cpp:965
CORE_API void FrameStart(bool bSkipThisFrame=false)
Definition ThreadHeartBeat.cpp:1158
static CORE_API FGameThreadHitchHeartBeatThreaded & Get()
Definition ThreadHeartBeat.cpp:925
static EThreadPriority GetGameThreadPriority()
Definition GenericPlatformAffinity.h:135
CORE_API void LoadAllCultureData()
Definition Internationalization.cpp:410
static CORE_API FInternationalization & Get()
Definition Internationalization.cpp:21
static CORE_API void TearDown()
Definition Internationalization.cpp:32
static CORE_API FIoStatus Initialize()
Definition IoDispatcher.cpp:1049
static CORE_API void InitializePostSettings()
Definition IoDispatcher.cpp:1058
static CORE_API void Shutdown()
Definition IoDispatcher.cpp:1066
Definition IoStatus.h:60
bool IsOk() const
Definition IoStatus.h:75
static CORE_API FLogSuppressionInterface & Get()
Definition LogSuppressionInterface.cpp:683
virtual void ProcessConfigAndCommandLine()=0
static CORE_API FMalloc * OverrideIfEnabled(FMalloc *InUsedAlloc)
Definition MallocFrameProfiler.cpp:189
CORE_API IModuleInterface * LoadModule(const FName InModuleName, ELoadModuleFlags InLoadModuleFlags=ELoadModuleFlags::None)
Definition ModuleManager.cpp:908
CORE_API IModuleInterface * GetModule(const FName InModuleName)
Definition ModuleManager.cpp:1478
CORE_API bool UnloadModule(const FName InModuleName, bool bIsShutdown=false, bool bAllowUnloadCode=true)
Definition ModuleManager.cpp:1302
static CORE_API FModuleManager & Get()
Definition ModuleManager.cpp:199
CORE_API IModuleInterface & LoadModuleChecked(const FName InModuleName)
Definition ModuleManager.cpp:952
CORE_API void UnloadModulesAtShutdown()
Definition ModuleManager.cpp:1419
CORE_API void AddExtraBinarySearchPaths()
Definition ModuleManager.cpp:2026
CORE_API void AddBinariesDirectory(const TCHAR *InDirectory, bool bIsGameDirectory)
Definition ModuleManager.cpp:2097
CORE_API void SetGameBinariesDirectory(const TCHAR *InDirectory)
Definition ModuleManager.cpp:2135
CORE_API void StartProcessingNewlyLoadedObjects()
Definition ModuleManager.cpp:2089
static TModuleInterface & GetModuleChecked(const FName ModuleName)
Definition ModuleManager.h:342
static MOVIEPLAYERPROXY_API void BlockingForceFinished()
Definition MoviePlayerProxy.cpp:31
static MOVIEPLAYERPROXY_API void SetIsSlateThreadAllowed(bool bInIsSlateThreadAllowed)
Definition MoviePlayerProxy.cpp:39
Definition NameTypes.h:617
static CORE_API void Reserve(uint32 NumBytes, uint32 NumNames)
Definition UnrealNames.cpp:2641
Definition ODSCManager.h:23
static ENGINE_API bool IsODSCEnabled()
Definition ODSCManager.cpp:273
virtual void Show(bool ShowWindow)=0
virtual bool IsAttached()
Definition OutputDeviceConsole.h:36
void SetIniFilename(const TCHAR *InFilename)
Definition OutputDeviceConsole.h:46
Definition OutputDeviceRedirector.h:54
static CORE_API FOutputDeviceRedirector * Get()
Definition OutputDeviceRedirector.cpp:748
Definition LaunchEngineLoop.cpp:394
FOutputDeviceTestExit(TArray< FString > &&InExitPhrases)
Definition LaunchEngineLoop.cpp:398
bool RequestExit()
Definition LaunchEngineLoop.cpp:405
virtual void Serialize(const TCHAR *V, ELogVerbosity::Type Verbosity, const class FName &Category) override
Definition LaunchEngineLoop.cpp:407
virtual ~FOutputDeviceTestExit()
Definition LaunchEngineLoop.cpp:402
FString RequestExitPhrase()
Definition LaunchEngineLoop.cpp:406
Definition OutputDevice.h:133
Definition PackageLocalizationManager.h:19
COREUOBJECT_API void InitializeFromDefaultCache()
Definition PackageLocalizationManager.cpp:121
COREUOBJECT_API void PerformLazyInitialization()
Definition PackageLocalizationManager.cpp:74
COREUOBJECT_API void InitializeFromLazyCallback(FLazyInitFunc InLazyInitFunc)
Definition PackageLocalizationManager.cpp:99
static COREUOBJECT_API FPackageLocalizationManager & Get()
Definition PackageLocalizationManager.cpp:253
static COREUOBJECT_API void RegisterShortPackageNamesForUObjectModules()
Definition PackageName.cpp:1836
CORE_API void LatchProtectedMode()
Definition MemStack.cpp:280
static CORE_API FPageAllocator & Get()
Definition MemStack.cpp:30
Definition IPlatformFilePak.h:1914
static const TCHAR * GetTypeName()
Definition IPlatformFilePak.h:2082
static CORE_API FStringView GetPath(const FStringView &InPath)
Definition PathViews.cpp:125
static CORE_API FStringView GetBaseFilename(const FStringView &InPath)
Definition PathViews.cpp:109
static CORE_API FString ProjectIntermediateDir()
Definition Paths.cpp:507
static UE_FORCEINLINE_HINT FString Combine(PathTypes &&... InPaths)
Definition Paths.h:737
static CORE_API bool IsProjectFilePathSet()
Definition Paths.cpp:882
static CORE_API bool IsSamePath(const FString &PathA, const FString &PathB)
Definition Paths.cpp:1902
static CORE_API void RemoveDuplicateSlashes(FString &InPath)
Definition Paths.cpp:1376
static CORE_API FString ProjectDir()
Definition Paths.cpp:457
static CORE_API bool DirectoryExists(const FString &InPath)
Definition Paths.cpp:1154
static CORE_API bool IsUnderDirectory(const FString &InPath, const FString &InDirectory)
Definition Paths.cpp:1917
static CORE_API bool FileExists(const FString &InPath)
Definition Paths.cpp:1149
static CORE_API FString ProjectPersistentDownloadDir()
Definition Paths.cpp:539
static CORE_API FString EnterpriseDir()
Definition Paths.cpp:284
static CORE_API FString ProjectLogDir()
Definition Paths.cpp:584
static CORE_API bool IsRelative(const FString &InPath)
Definition Paths.cpp:1267
static CORE_API void NormalizeFilename(FString &InPath)
Definition Paths.cpp:1334
static CORE_API FString GetBaseFilename(const FString &InPath, bool bRemovePath=true)
Definition Paths.cpp:1033
static CORE_API FString EngineDir()
Definition Paths.cpp:199
static CORE_API bool CollapseRelativeDirectories(FString &InPath, bool bCollapseAllPossible=false)
Definition Paths.cpp:1362
static CORE_API FString GetCleanFilename(const FString &InPath)
Definition Paths.cpp:967
static CORE_API FString GetProjectFilePath()
Definition Paths.cpp:889
static CORE_API FString RootDir()
Definition Paths.cpp:452
static CORE_API FString ConvertRelativePathToFull(const FString &InPath)
Definition Paths.cpp:1586
static CORE_API FString EngineIntermediateDir()
Definition Paths.cpp:248
static CORE_API FString FindCorrectCase(const FString &Path)
Definition Paths.cpp:904
static CORE_API FString ProjectContentDir()
Definition Paths.cpp:486
static CORE_API bool HasProjectPersistentDownloadDir()
Definition Paths.cpp:534
static CORE_API void SetProjectFilePath(const FString &NewGameProjectFilePath)
Definition Paths.cpp:896
static CORE_API FString GetExtension(const FString &InPath, bool bIncludeDot=false)
Definition Paths.cpp:955
Definition RenderDeferredCleanup.h:20
void Initialize()
Definition IPlatformFileManagedStorageWrapper.h:366
static CORE_API FPersistentStorageManager & Get()
Definition IPlatformFileManagedStorageWrapper.cpp:200
CORE_API void TickActivePlatformFile()
Definition PlatformFileManager.cpp:66
CORE_API IPlatformFile * FindPlatformFile(const TCHAR *Name)
Definition PlatformFileManager.cpp:53
CORE_API void SetPlatformPhysical(IPlatformFile &NewPhysicalPlatformFile)
Definition PlatformFileManager.cpp:47
CORE_API void InitializeNewAsyncIO()
Definition PlatformFileManager.cpp:167
CORE_API void SetPlatformFile(IPlatformFile &NewTopmostPlatformFile)
Definition PlatformFileManager.cpp:41
CORE_API IPlatformFile & GetPlatformFile()
Definition PlatformFileManager.cpp:22
static CORE_API FPlatformFileManager & Get()
Definition PlatformFileManager.cpp:185
PRELOADSCREEN_API bool HasRegisteredPreLoadScreenType(EPreLoadScreenTypes PreLoadScreenTypeToCheck) const
Definition PreLoadScreenManager.cpp:416
PRELOADSCREEN_API void WaitForEngineLoadingScreenToFinish()
Definition PreLoadScreenManager.cpp:661
static PRELOADSCREEN_API bool ArePreLoadScreensEnabled()
Definition PreLoadScreenManager.cpp:711
PRELOADSCREEN_API TSharedPtr< SWindow > GetRenderWindow()
Definition PreLoadScreenManager.cpp:656
PRELOADSCREEN_API void Initialize(FSlateRenderer &InSlateRenderer)
Definition PreLoadScreenManager.cpp:84
static PRELOADSCREEN_API void Create()
Definition PreLoadScreenManager.cpp:43
PRELOADSCREEN_API bool PlayFirstPreLoadScreen(EPreLoadScreenTypes PreLoadScreenTypeToPlay)
Definition PreLoadScreenManager.cpp:161
PRELOADSCREEN_API void SetEngineLoadingComplete(bool IsEngineLoadingFinished=true)
Definition PreLoadScreenManager.cpp:700
PRELOADSCREEN_API void PassPreLoadScreenWindowBackToGame() const
Definition PreLoadScreenManager.cpp:635
FIsPreloadScreenResponsibleForRenderingMultiDelegate IsResponsibleForRenderingDelegate
Definition PreLoadScreenManager.h:71
static PRELOADSCREEN_API void Destroy()
Definition PreLoadScreenManager.cpp:53
static PRELOADSCREEN_API FPreLoadScreenManager * Get()
Definition PreLoadScreenManager.cpp:38
Definition QueuedThreadPoolWrapper.h:373
Definition QueuedThreadPoolWrapper.h:44
virtual bool Create(uint32 InNumQueuedThreads, uint32 StackSize=(32 *1024), EThreadPriority ThreadPriority=TPri_Normal, const TCHAR *Name=TEXT("UnknownThreadPool"))=0
static CORE_API FQueuedThreadPool * Allocate()
Definition ThreadingBase.cpp:1416
virtual void Destroy()=0
Definition RHICommandList.h:4626
RHI_API void EndFrame()
Definition RHICommandList.cpp:1934
void EnqueueLambda(const TCHAR *LambdaName, LAMBDA &&Lambda)
Definition RHICommandList.h:4709
static FRHICommandListImmediate & Get()
Definition RHICommandList.h:5522
static COREUOBJECT_API void NotifyRegistrationComplete()
Definition ReferencerFinder.cpp:78
static CORE_API void Flush()
Definition RemoteConfigIni.cpp:372
Definition Reply.h:24
static FReply Unhandled()
Definition Reply.h:241
Definition SceneInterface.h:106
Definition LightweightStats.h:424
Definition ScopeLock.h:141
static ENGINE_API void GenerateBrdfHeaders(const EShaderPlatform Platform)
Definition ShaderCompiler.h:894
static RENDERCORE_API void CommitAll()
Definition ShaderParameterMetadata.cpp:241
static RENDERCORE_API void InitializeAllUniformBufferStructs()
Definition ShaderParameterMetadata.cpp:530
static RENDERCORE_API bool OpenPipelineFileCache(EShaderPlatform Platform)
Definition ShaderPipelineCache.cpp:852
static RENDERCORE_API void PauseBatching()
Definition ShaderPipelineCache.cpp:754
static RENDERCORE_API void Shutdown()
Definition ShaderPipelineCache.cpp:745
static RENDERCORE_API void Initialize(EShaderPlatform Platform)
Definition ShaderPipelineCache.cpp:734
static RENDERCORE_API void ResumeBatching()
Definition ShaderPipelineCache.cpp:809
static RENDERCORE_API void CommitAll()
Definition Shader.cpp:327
Definition SlateApplication.h:252
SLATE_API void PollGameDeviceState()
Definition SlateApplication.cpp:1504
static SLATE_API void Shutdown(bool bShutdownPlatform=true)
Definition SlateApplication.cpp:836
static SLATE_API void InitHighDPI(const bool bForceEnable)
Definition SlateApplication.cpp:998
static SLATE_API void Create()
Definition SlateApplication.cpp:787
SLATE_API void Tick(ESlateTickType TickType=ESlateTickType::All)
Definition SlateApplication.cpp:1591
SLATE_API bool GeneratePathToWidgetUnchecked(TSharedRef< const SWidget > InWidget, FWidgetPath &OutWidgetPath, EVisibility VisibilityFilter=EVisibility::Visible) const
Definition SlateApplication.cpp:3247
SLATE_API void ProcessExternalReply(const FWidgetPath &CurrentEventPath, const FReply TheReply, const int32 UserIndex=0, const int32 PointerIndex=10)
Definition SlateApplication.cpp:3299
SLATE_API void FinishedInputThisFrame()
Definition SlateApplication.cpp:1513
static FSlateApplication & Get()
Definition SlateApplication.h:319
static bool IsInitialized()
Definition SlateApplication.h:308
SLATE_API int32 GetUserIndexForController(int32 ControllerId) const
Definition SlateApplication.cpp:2595
static SLATE_API void InitializeCoreStyle()
Definition SlateApplication.cpp:7520
Definition SlateRenderer.h:173
ENGINE_API void Initialize(bool bSetupForEditor)
Definition SystemSettings.cpp:215
CORE_API void Tick(float DeltaTime)
Definition Ticker.cpp:60
static CORE_API FTSTicker & GetCoreTicker()
Definition Ticker.cpp:8
virtual void AttachToThread(ENamedThreads::Type CurrentThread)=0
static CORE_API void Shutdown()
Definition TaskGraph.cpp:1783
static CORE_API FTaskGraphInterface & Get()
Definition TaskGraph.cpp:1794
static CORE_API void Startup(int32 NumThreads)
Definition TaskGraph.cpp:1760
Definition CoreGlobals.h:672
static CORE_API FTextLocalizationManager & Get()
Definition TextLocalizationManager.cpp:666
static CORE_API void TearDown()
Definition TextLocalizationManager.cpp:671
CORE_API void WaitForAsyncTasks()
Definition TextLocalizationManager.cpp:1196
Definition Text.h:385
static CORE_API FText FromString(const ANSICHAR *String)
Definition Text.cpp:1081
static CORE_API FText Format(FTextFormat Fmt, const FFormatNamedArguments &InArguments)
Definition Text.cpp:469
CORE_API const FString & ToString() const
Definition Text.cpp:1263
CORE_API void HeartBeat()
Definition ThreadHeartBeat.cpp:429
CORE_API void Start()
Definition ThreadHeartBeat.cpp:346
CORE_API void InitSettings()
Definition ThreadHeartBeat.cpp:351
static CORE_API FThreadHeartBeat & Get()
Definition ThreadHeartBeat.cpp:119
CORE_API void Tick()
Definition ThreadingBase.cpp:546
static CORE_API FThreadManager & Get()
Definition ThreadingBase.cpp:685
static CORE_API void InitializePresets(const TCHAR *CommandLine)
Definition TraceAuxiliary.cpp:2213
static CORE_API void EnableCommandlineChannels()
Definition TraceAuxiliary.cpp:2248
static CORE_API void Initialize(const TCHAR *CommandLine)
Definition TraceAuxiliary.cpp:1968
static CORE_API void Shutdown()
Definition TraceAuxiliary.cpp:2233
static CORE_API void TryAutoConnect()
Definition TraceAuxiliary.cpp:2406
Definition TraceService.h:12
Definition TrackedActivity.h:126
static CORE_API FTrackedActivity & GetEngineActivity()
Definition TrackedActivity.cpp:221
bool IsOpenForDisregardForGC() const
Definition UObjectArray.h:1040
int32 GetObjectArrayNumMinusAvailable() const
Definition UObjectArray.h:1274
COREUOBJECT_API void CloseDisregardForGC()
Definition UObjectArray.cpp:146
static CORE_API FUProjectDictionary & GetDefault()
Definition UProjectInfo.cpp:135
CORE_API FString GetRelativeProjectPathForGame(const TCHAR *GameName, const FString &BaseDir) const
Definition UProjectInfo.cpp:107
static ENGINE_API void SetGameRenderingEnabled(bool bIsEnabled, int32 PresentAndStopMovieDelay=0)
Definition UnrealClient.cpp:2340
Definition WidgetPath.h:51
static CORE_API void Shutdown()
Definition WindowsPlatformPerfCounters.cpp:193
static CORE_API void Init()
Definition WindowsPlatformPerfCounters.cpp:176
Definition IConsoleManager.h:558
virtual void Set(const TCHAR *InValue, const FResolvedContext &Context)=0
virtual float GetFloat() const =0
virtual FArchive * CreateFileWriter(const TCHAR *Filename, uint32 WriteFlags=0)=0
virtual void ProcessCommandLineOptions()=0
static CORE_API IFileManager & Get()
Definition FileManagerGeneric.cpp:1072
virtual bool MakeDirectory(const TCHAR *Path, bool Tree=0)=0
virtual bool DeleteDirectory(const TCHAR *Path, bool RequireExists=0, bool Tree=0)=0
virtual FString ConvertToAbsolutePathForExternalAppForWrite(const TCHAR *Filename)=0
virtual bool IterateDirectory(const TCHAR *Directory, IPlatformFile::FDirectoryVisitor &Visitor)=0
virtual void WaitForMovieToFinish(bool bAllowEngineTick=false)=0
virtual void SetupLoadingScreenFromIni()=0
virtual bool PlayMovie()=0
virtual void PassLoadingScreenWindowBackToGame() const =0
virtual void Initialize(class FSlateRenderer &InSlateRenderer, TSharedPtr< SWindow > RenderTarget=nullptr)=0
virtual bool PlayEarlyStartupMovies()=0
Definition IHeadMountedDisplayModule.h:19
static FName GetModularFeatureName()
Definition IHeadMountedDisplayModule.h:21
Definition HotReloadInterface.h:39
static IHotReloadInterface * GetPtr()
Definition HotReloadInterface.h:44
static INSTALLBUNDLEMANAGER_API FInstallBundleCompleteMultiDelegate InstallBundleCompleteDelegate
Definition InstallBundleManagerInterface.h:131
static INSTALLBUNDLEMANAGER_API TSharedPtr< IInstallBundleManager > GetPlatformInstallBundleManager()
Definition InstallBundleManagerInterface.cpp:23
virtual bool RunLauncher(ELauncherAction Action, FString Payload=FString()) const =0
static ILauncherCheckModule & Get()
Definition ILauncherCheckModule.h:39
Definition IMediaModule.h:35
virtual void TickPostRender()=0
virtual void SetTimeSource(const TSharedPtr< IMediaTimeSource, ESPMode::ThreadSafe > &NewTimeSource)=0
Definition IModularFeatures.h:15
static CORE_API IModularFeatures & Get()
Definition ModularFeatures.cpp:9
Definition IOSAppDelegate.cpp:247
static COREUOBJECT_API void Initialize()
Definition PackageResourceManager.cpp:40
static COREUOBJECT_API void Shutdown()
Definition PackageResourceManager.cpp:62
static IPlatformFeaturesModule & Get()
Definition PlatformFeatures.h:20
Definition GenericPlatformFile.h:342
virtual IPlatformFile * GetLowerLevel()=0
virtual CORE_API bool CreateDirectoryTree(const TCHAR *Directory)
Definition GenericPlatformFile.cpp:1033
virtual bool CreateDirectory(const TCHAR *Directory)=0
Definition IPluginManager.h:274
static PROJECTS_API IPluginManager & Get()
Definition PluginManager.cpp:2993
virtual void SetPreloadBinaries()=0
virtual void SetBinariesRootDirectories(const FString &EngineBinariesRootDir, const FString &ProjectBinariesRootDir)=0
virtual bool CheckModuleCompatibility(TArray< FString > &OutIncompatibleModules, TArray< FString > &OutIncompatibleEngineModules)=0
virtual void RefreshPluginsList()=0
virtual bool GetPreloadBinaries()=0
virtual bool AreRequiredPluginsAvailable()=0
virtual bool LoadModulesForEnabledPlugins(const ELoadingPhase::Type LoadingPhase)=0
Definition IProjectManager.h:71
static PROJECTS_API IProjectManager & Get()
Definition ProjectManager.cpp:536
virtual const FString & GetAutoLoadProjectFileName()=0
virtual bool SubstituteModule(const FString &OriginalModuleName, const FString &NewModuleName)=0
Definition RHIUnitTests.h:8
virtual void RunAllTests()=0
virtual void InitializeSystemTextures(FRHICommandListImmediate &RHICmdList)=0
Definition ISlateNullRendererModule.h:15
Definition ISlateRHIRendererModule.h:23
Definition Renderer.Build.cs:6
Definition SViewport.h:31
Definition Array.h:670
UE_FORCEINLINE_HINT SizeType AddUninitialized()
Definition Array.h:1664
ElementType * FindByPredicate(Predicate Pred)
Definition Array.h:1471
UE_REWRITE SizeType Num() const
Definition Array.h:1144
void RemoveAt(SizeType Index, EAllowShrinking AllowShrinking=UE::Core::Private::AllowShrinkingByDefault< AllocatorType >())
Definition Array.h:2083
bool Contains(const ComparisonType &Item) const
Definition Array.h:1518
UE_REWRITE bool IsEmpty() const
Definition Array.h:1133
UE_FORCEINLINE_HINT SizeType Emplace(ArgsType &&... Args)
Definition Array.h:2561
UE_NODEBUG UE_FORCEINLINE_HINT SizeType Add(ElementType &&Item)
Definition Array.h:2696
SizeType RemoveAll(const PREDICATE_CLASS &Predicate)
Definition Array.h:3108
Definition IConsoleManager.h:1792
T GetValueOnAnyThread(bool bForceGameThread=false) const
Definition IConsoleManager.h:1854
T GetValueOnGameThread() const
Definition IConsoleManager.h:1844
Definition AndroidPlatformMisc.h:14
FGraphEventRef ConstructAndDispatchWhenReady(T &&... Args)
Definition TaskGraphInterfaces.h:614
static FConstructor CreateTask(const FGraphEventArray *Prerequisites=nullptr, ENamedThreads::Type CurrentThreadIfKnown=ENamedThreads::AnyThread)
Definition TaskGraphInterfaces.h:664
Definition Array.h:64
Definition SharedPointer.h:692
TSharedRef< ObjectType, Mode > ToSharedRef() const &
Definition SharedPointer.h:1028
UE_FORCEINLINE_HINT const bool IsValid() const
Definition SharedPointer.h:1085
Definition SharedPointer.h:153
Definition StringConv.h:671
void LeftInline(int32 CharCount)
Definition StringView.h:249
Definition StrongObjectPtrTemplates.h:26
Definition UniquePtr.h:107
Definition Class.h:3793
Definition Commandlet.h:41
Definition DemoNetDriver.h:154
static ENGINE_API void InitializeCVarsForActiveDeviceProfile(bool bPushSettings=false, bool bIsDeviceProfilePreview=false, bool bForceReload=false)
Definition DeviceProfileManager.cpp:835
static void EndCriticalPath()
Definition ThreadIdleStats.h:49
Definition StereoRenderUtils.h:16
static ENGINE_API void SetSimulationLatencyMarkerStart(uint64 FrameNumber)
Definition UnrealEngine.cpp:2599
ENGINE_API FWorldContext * GetWorldContextFromHandle(const FName WorldContextHandle)
Definition UnrealEngine.cpp:16610
virtual void Tick(float DeltaSeconds, bool bIdleMode) PURE_VIRTUAL(UEngine virtual ENGINE_API void UpdateTimeAndHandleMaxTickRate()
Definition UnrealEngine.cpp:2678
TObjectPtr< class UGameViewportClient > GameViewport
Definition Engine.h:1562
static ENGINE_API void SetInputSampleLatencyMarker(uint64 FrameNumber)
Definition UnrealEngine.cpp:2589
ENGINE_API void EmitDynamicResolutionEvent(EDynamicResolutionStateEvent Event)
Definition UnrealEngine.cpp:13946
virtual ENGINE_API void Start()
Definition UnrealEngine.cpp:2377
static ENGINE_API void SetRenderSubmitLatencyMarkerStart(uint64 FrameNumber)
Definition UnrealEngine.cpp:2644
virtual ENGINE_API void Init(IEngineLoop *InEngineLoop)
Definition UnrealEngine.cpp:2052
virtual ENGINE_API void PreExit()
Definition UnrealEngine.cpp:2407
static ENGINE_API void SetRenderSubmitLatencyMarkerEnd(uint64 FrameNumber)
Definition UnrealEngine.cpp:2656
virtual ENGINE_API void ReleaseAudioDeviceManager()
Definition UnrealEngine.cpp:2400
virtual bool ShouldDoAsyncEndOfFrameTasks() const
Definition Engine.h:3603
static ENGINE_API void SetSimulationLatencyMarkerEnd(uint64 FrameNumber)
Definition UnrealEngine.cpp:2609
TArray< FString > DeferredCommands
Definition Engine.h:1566
virtual bool IsRenderingSuspended() const
Definition Engine.h:2553
ENGINE_API void TickPerformanceMonitoring(float DeltaSeconds)
Definition ChartCreation.cpp:1436
ENGINE_API void ParseCommandline()
Definition UnrealEngine.cpp:3000
ENGINE_API void TickDeferredCommands()
Definition UnrealEngine.cpp:2472
Definition GameEngine.h:26
ENGINE_API UWorld * GetGameWorld()
Definition GameEngine.cpp:2128
ENGINE_API void SwitchGameWindowToUseGameViewport()
Definition GameEngine.cpp:711
static ENGINE_API void PreloadResolutionSettings(bool bAllowCmdLineOverrides=true)
Definition GameUserSettings.cpp:677
Definition GameViewportClient.h:71
ENGINE_API FSceneViewport * GetGameViewport()
Definition GameViewportClient.cpp:459
virtual ENGINE_API UWorld * GetWorld() const override
Definition GameViewportClient.cpp:633
Definition LocalPlayer.h:169
static ENGINE_API void InitDefaultMaterials()
Definition Material.cpp:585
static ENGINE_API void AssertDefaultMaterialsPostLoaded()
Definition Material.cpp:793
static ENGINE_API void AssertDefaultMaterialsExist()
Definition Material.cpp:780
static ENGINE_API UOnlineEngineInterface * Get()
Definition OnlineEngineInterface.cpp:19
static ENGINE_API void InitializeEngineBridge()
Definition StringTable.cpp:411
static ENGINE_API void CancelPendingTextureStreaming()
Definition Texture.cpp:1595
Definition World.h:918
UE_API FConstPlayerControllerIterator GetPlayerControllerIterator() const
Definition World.cpp:6403
UE_API bool IsCameraMoveable() const
Definition LevelTick.cpp:452
UE_API AWorldSettings * GetWorldSettings(bool bCheckStreamingPersistent=false, bool bChecked=true) const
Definition World.cpp:6810
void InitializeForUE()
Definition AutoRTFMUE.h:20
@ Ok
Definition GenericPlatformMisc.h:307
@ YesNoCancel
Definition GenericPlatformMisc.h:310
@ YesNo
Definition GenericPlatformMisc.h:308
@ No
Definition GenericPlatformMisc.h:326
@ Yes
Definition GenericPlatformMisc.h:327
@ Cancel
Definition GenericPlatformMisc.h:330
Type
Definition CompilationResult.h:17
@ Unknown
Definition CompilationResult.h:43
@ FailedDueToEngineChange
Definition CompilationResult.h:29
@ PostSplashScreen
Definition ModuleDescriptor.h:35
@ EarliestPossible
Definition ModuleDescriptor.h:29
@ PreLoadingScreen
Definition ModuleDescriptor.h:41
@ Default
Definition ModuleDescriptor.h:47
@ PostEngineInit
Definition ModuleDescriptor.h:53
@ PreDefault
Definition ModuleDescriptor.h:44
@ PreEarlyLoadingScreen
Definition ModuleDescriptor.h:38
@ PostConfigInit
Definition ModuleDescriptor.h:32
@ PostDefault
Definition ModuleDescriptor.h:50
Type
Definition OutputDevice.h:111
@ UTC
Definition OutputDevice.h:116
@ Timecode
Definition OutputDevice.h:125
@ None
Definition OutputDevice.h:113
@ Local
Definition OutputDevice.h:122
@ SinceGStartTime
Definition OutputDevice.h:119
Type
Definition LogVerbosity.h:17
@ Warning
Definition LogVerbosity.h:34
Type
Definition TaskGraphInterfaces.h:57
@ NormalTaskPriority
Definition TaskGraphInterfaces.h:81
@ GameThread
Definition TaskGraphInterfaces.h:61
@ HighThreadPriority
Definition TaskGraphInterfaces.h:89
@ HighTaskPriority
Definition TaskGraphInterfaces.h:82
@ SM5
Definition RHIFeatureLevel.h:42
@ ES3_1
Definition RHIFeatureLevel.h:25
@ IgnoreCase
Definition CString.h:26
@ CaseSensitive
Definition CString.h:23
Type
Definition TaskGraphInterfaces.h:249
@ TrackSubsequents
Definition TaskGraphInterfaces.h:251
@ Game
Definition EngineTypes.h:1269
@ PIE
Definition EngineTypes.h:1275
void Sync(bool bFullSync)
Definition UnrealEngine.cpp:13679
void CORE_API StartupPreInit(void)
Definition OodleDataCompression.cpp:591
Definition PipelineStateCache.cpp:26
RHI_API void WaitForAllTasks()
Definition PipelineStateCache.cpp:4720
RHI_API void Init()
Definition PipelineStateCache.cpp:4736
FPlatformMemoryStats GetFrameMemoryStats()
Definition PlatformMemoryHelpers.cpp:14
void LoadState(const FString &IniName)
Definition Scalability.cpp:1172
void InitScalabilitySystem()
Definition Scalability.cpp:614
void ApplyCVarsFromBootHotfix()
Definition ConfigUtilities.cpp:270
void RecordConfigReadsFromIni()
Definition ConfigUtilities.cpp:713
void DumpRecordedConfigReadsFromIni()
Definition ConfigUtilities.cpp:721
void DeleteRecordedConfigReadsFromIni()
Definition ConfigUtilities.cpp:729
void DeleteRecordedCVarSettingsFromIni()
Definition ConfigUtilities.cpp:707
void RecordApplyCVarSettingsFromIni()
Definition ConfigUtilities.cpp:683
void ApplyCVarSettingsFromIni(const TCHAR *InSectionName, const TCHAR *InIniFilename, uint32 SetBy, bool bAllowCheating, FName Tag)
Definition ConfigUtilities.cpp:418
void ReapplyRecordedCVarSettingsFromIni()
Definition ConfigUtilities.cpp:689
void SetMultiprocessId(int32 MultiprocessId)
Definition CoreGlobals.cpp:1013
RENDERCORE_API void VerifyISRConfig(const UE::StereoRenderUtils::FStereoShaderAspects &Aspects, EShaderPlatform ShaderPlatform)
Definition StereoRenderUtils.cpp:171
RENDERCORE_API void LogISRInit(const UE::StereoRenderUtils::FStereoShaderAspects &Aspects)
Definition StereoRenderUtils.cpp:153
UE_STRING_CLASS Result(Forward< LhsType >(Lhs), RhsLen)
Definition String.cpp.inl:732
UE_TRACE_API bool IsTracing() UE_TRACE_IMPL(false)
WideString
Definition Trace.h:53
UE_TRACE_API void Exit() UE_TRACE_IMPL()
void Initialize(EInitializationFlags Flags)
Definition VirtualizationSystem.cpp:275
void Shutdown()
Definition VirtualizationSystem.cpp:365
bool ShouldInitializePreSlate()
Definition VirtualizationSystem.cpp:357
bool IsUsingZenPakFileStreaming()
Definition CoreGlobals.cpp:980
@ WorldContext
[FunctionMetadata] Used by BlueprintCallable functions to indicate which parameter is used to determi...
Definition ObjectMacros.h:1730
@ false
Definition radaudio_common.h:23
U16 Index
Definition radfft.cpp:71
static INPUTCORE_API void Initialize()
Definition InputCoreTypes.cpp:512
static APPLICATIONCORE_API class FFeedbackContext * GetFeedbackContext()
Definition AndroidPlatformApplicationMisc.cpp:23
static APPLICATIONCORE_API void LoadPreInitModules()
Definition AndroidPlatformApplicationMisc.cpp:14
static APPLICATIONCORE_API class FOutputDeviceError * GetErrorOutputDevice()
Definition AndroidPlatformApplicationMisc.cpp:29
static CORE_API void RequestExit(bool Force, const TCHAR *CallSite=nullptr)
Definition AndroidPlatformMisc.cpp:267
static CORE_API void PlatformTearDown()
Definition AndroidPlatformMisc.cpp:647
static CORE_API void PlatformHandleSplashScreen(bool ShowSplashScreen)
Definition AndroidPlatformMisc.cpp:695
static CORE_API void PlatformPreInit()
Definition AndroidPlatformMisc.cpp:361
static CORE_API void PlatformInit()
Definition AndroidPlatformMisc.cpp:582
static CORE_API FString GetEnvironmentVariable(const TCHAR *VariableName)
Definition AndroidPlatformMisc.cpp:707
static CORE_API bool UseRenderThread()
Definition AndroidPlatformMisc.cpp:905
static CORE_API EAppReturnType::Type MessageBoxExt(EAppMsgType::Type MsgType, const TCHAR *Text, const TCHAR *Caption)
Definition AndroidPlatformMisc.cpp:739
static CORE_API void Init()
Definition AndroidPlatformMemory.cpp:78
static CORE_API void * GetDllHandle(const TCHAR *Filename)
Definition AndroidPlatformProcess.cpp:33
static CORE_API bool GetPerFrameProcessorUsage(uint32 ProcessId, float &ProcessUsageFraction, float &IdleUsageFraction)
Definition AndroidPlatformProcess.cpp:178
static CORE_API void SetThreadAffinityMask(uint64 AffinityMask)
Definition AndroidPlatformProcess.cpp:76
static CORE_API const TCHAR * ExecutableName(bool bRemoveExtension=true)
Definition AndroidPlatformProcess.cpp:107
static CORE_API const TCHAR * BaseDir()
Definition AndroidPlatformProcess.cpp:102
static CORE_API uint32 GetCurrentProcessId()
Definition AndroidPlatformProcess.cpp:90
static uint32 GetCurrentThreadId(void)
Definition AndroidPlatformTLS.h:20
static uint32 Cycles()
Definition AndroidPlatformTime.h:27
static double Seconds()
Definition AndroidPlatformTime.h:20
static uint64 Cycles64()
Definition AndroidPlatformTime.h:34
Definition CoreMisc.h:243
static CORE_API void OnPreInitPostStartupScreenComplete()
Definition BootProfiling.cpp:41
static CORE_API void OnInitComplete()
Definition BootProfiling.cpp:46
static CORE_API void InitCounters()
Definition BootProfiling.cpp:52
static CORE_API void OnPreInitPreStartupScreenComplete()
Definition BootProfiling.cpp:36
Definition GenericPlatformTime.h:16
Definition Color.h:486
static CORE_API const FColor Red
Definition Color.h:752
static CORE_API const FColor Cyan
Definition Color.h:756
static CORE_API const FColor Orange
Definition Color.h:758
static CORE_API void Append(const TCHAR *AppendString)
Definition CommandLine.cpp:138
static CORE_API FString BuildFromArgV(const WIDECHAR *Prefix, int32 ArgC, WIDECHAR *ArgV[], const WIDECHAR *Suffix)
Definition CommandLine.cpp:552
static CORE_API bool Set(const TCHAR *NewCommandLine)
Definition CommandLine.cpp:85
static CORE_API const TCHAR * Get()
Definition CommandLine.cpp:61
static CORE_API const TCHAR * GetOriginal()
Definition CommandLine.cpp:73
static CORE_API void AddToSubprocessCommandLine(const TCHAR *Param, ECommandLineArgumentFlags ApplicationContextFlags)
Definition CommandLine.cpp:382
static COREUOBJECT_API FSimpleMulticastDelegate PostGarbageCollectConditionalBeginDestroy
Definition UObjectGlobals.h:3435
static COREUOBJECT_API FSimpleMulticastDelegate PreGarbageCollectConditionalBeginDestroy
Definition UObjectGlobals.h:3432
CORE_API FString ToString() const
Definition DateTime.cpp:222
static CORE_API FDateTime Now()
Definition DateTime.cpp:377
static CORE_API void RunAndClearDelayedAutoRegisterDelegates(EDelayedRegisterRunPhase RunPhase)
Definition DelayedAutoRegister.cpp:55
static CORE_API bool LoadFileToString(FString &Result, FArchive &Reader, EHashOptions VerifyFlags=EHashOptions::None)
Definition FileHelper.cpp:202
static CORE_API bool SaveStringToFile(FStringView String, const TCHAR *Filename, EEncodingOptions EncodingOptions=EEncodingOptions::AutoDetect, IFileManager *FileManager=&IFileManager::Get(), uint32 WriteFlags=0)
Definition FileHelper.cpp:669
static void LoadStartupModules()
Definition GenericPlatformApplicationMisc.h:89
static APPLICATIONCORE_API void PreInit()
Definition GenericPlatformApplicationMisc.cpp:43
static APPLICATIONCORE_API void Init()
Definition GenericPlatformApplicationMisc.cpp:47
static APPLICATIONCORE_API FOutputDeviceConsole * CreateConsoleOutputDevice()
Definition GenericPlatformApplicationMisc.cpp:63
static APPLICATIONCORE_API void PostInit()
Definition GenericPlatformApplicationMisc.cpp:53
static APPLICATIONCORE_API void TearDown()
Definition GenericPlatformApplicationMisc.cpp:57
static void PumpMessages(bool bFromMainLoop)
Definition GenericPlatformApplicationMisc.h:133
uint64 AvailablePhysical
Definition GenericPlatformMemory.h:135
static CORE_API uint64 GetExtraDevelopmentMemorySize()
Definition GenericPlatformMemory.cpp:568
static void SetShouldPromptForRemoteDebugOnEnsure(bool bInShouldPrompt)
Definition GenericPlatformMisc.h:1408
static bool CommandLineCommands()
Definition GenericPlatformMisc.h:1107
static CORE_API bool GetEngineAndProjectAbsoluteDirsFromExecutable(FString &OutProjectDir, FString &OutEngineDir)
Definition GenericPlatformMisc.cpp:1441
static CORE_API void VARARGS LowLevelOutputDebugStringf(const TCHAR *Format,...)
Definition GenericPlatformMisc.cpp:940
static CORE_API void SetUTF8Output()
Definition GenericPlatformMisc.cpp:957
static FORCEINLINE void InitTaggedStorage(uint32 NumTags)
Definition GenericPlatformMisc.h:956
static bool AllowAudioThread()
Definition GenericPlatformMisc.h:1165
static CORE_API void RequestExitWithStatus(bool Force, uint8 ReturnCode, const TCHAR *CallSite=nullptr)
Definition GenericPlatformMisc.cpp:1008
static CORE_API int32 NumberOfWorkerThreadsToSpawn()
Definition GenericPlatformMisc.cpp:1722
static void SetShouldPromptForRemoteDebugging(bool bInShouldPrompt)
Definition GenericPlatformMisc.h:1403
static CORE_API void AddAdditionalRootDirectory(const FString &RootDir)
Definition GenericPlatformMisc.cpp:1205
static void SetGracefulTerminationHandler()
Definition GenericPlatformMisc.h:583
static CORE_API int32 NumberOfIOWorkerThreadsToSpawn()
Definition GenericPlatformMisc.cpp:1734
static FORCEINLINE void BeginNamedEventFrame()
Definition GenericPlatformMisc.h:917
static CORE_API TArray< FString > GetAdditionalRootDirectories()
Definition GenericPlatformMisc.cpp:1187
static FORCEINLINE void ShutdownTaggedStorage()
Definition GenericPlatformMisc.h:963
static CORE_API const TCHAR * EngineDir()
Definition GenericPlatformMisc.cpp:1253
static CORE_API void TickHotfixables()
Definition GenericPlatformMisc.cpp:1844
static CORE_API const TCHAR * ProjectDir()
Definition GenericPlatformMisc.cpp:1316
static CORE_API void SetupOutputDevices()
Definition GenericPlatformOutputDevices.cpp:21
static CORE_API FOutputDeviceError * GetError()
Definition GenericPlatformOutputDevices.cpp:204
static CORE_API FFeedbackContext * GetFeedbackContext()
Definition GenericPlatformOutputDevices.cpp:210
static CORE_API const TCHAR * ExecutablePath()
Definition GenericPlatformProcess.cpp:211
static CORE_API void SetCurrentWorkingDirectoryToBaseDir()
Definition GenericPlatformProcess.cpp:151
static CORE_API const TCHAR * ShaderDir()
Definition GenericPlatformProcess.cpp:169
static UE_FORCEINLINE_HINT void AddDllDirectory(const TCHAR *Directory)
Definition GenericPlatformProcess.h:313
static CORE_API bool SupportsMultithreading()
Definition GenericPlatformProcess.cpp:656
static CORE_API class FEvent * GetSynchEventFromPool(bool bIsManualReset=false)
Definition GenericPlatformProcess.cpp:576
static CORE_API const TCHAR * GetArchitectureSuffix()
Definition GenericPlatformProcess.cpp:229
static CORE_API bool IsFirstInstance()
Definition GenericPlatformProcess.cpp:707
static CORE_API void ReturnSynchEventToPool(FEvent *Event)
Definition GenericPlatformProcess.cpp:589
static CORE_API void SetThreadPriority(EThreadPriority NewPriority)
Definition GenericPlatformProcess.cpp:88
static CORE_API const TCHAR * GetBinariesSubdirectory()
Definition GenericPlatformProcess.cpp:245
static CORE_API const TCHAR * GetModuleExtension()
Definition GenericPlatformProcess.cpp:239
static CORE_API FString GenerateApplicationPath(const FString &AppName, EBuildConfiguration BuildConfiguration)
Definition GenericPlatformProcess.cpp:223
static void SetupGameThread()
Definition GenericPlatformProcess.h:384
static CORE_API FProcHandle CreateProc(const TCHAR *URL, const TCHAR *Parms, bool bLaunchDetached, bool bLaunchHidden, bool bLaunchReallyHidden, uint32 *OutProcessID, int32 PriorityModifier, const TCHAR *OptionalWorkingDirectory, void *PipeWriteChild, void *PipeReadChild=nullptr)
Definition GenericPlatformProcess.cpp:293
static CORE_API void CleanShaderWorkingDir()
Definition GenericPlatformProcess.cpp:201
static void Show()
Definition GenericPlatformSplash.h:43
static CORE_API void Init()
Definition GenericPlatformStackWalk.cpp:34
static double ToMilliseconds64(const uint64 Cycles)
Definition GenericPlatformTime.h:202
static FCPUTime GetCPUTime()
Definition GenericPlatformTime.h:135
static float ToMilliseconds(const uint32 Cycles)
Definition GenericPlatformTime.h:183
ENGINE_API void Init()
Definition HighResScreenshot.cpp:57
Definition InstallBundleManagerInterface.h:49
static CORE_API void DeleteOldLogs()
Definition FileHelper.cpp:1211
static CORE_API void SetupTLSCachesOnCurrentThread()
Definition UnrealMemory.cpp:573
static CORE_API void EnablePurgatoryTests()
Definition UnrealMemory.cpp:243
static CORE_API void EnablePoisonTests()
Definition UnrealMemory.cpp:270
static CORE_API EAppReturnType::Type Open(EAppMsgType::Type MessageType, const FText &Message)
Definition MessageDialog.cpp:84
Definition LaunchEngineLoop.cpp:550
static void HandlePakMountError()
Definition LaunchEngineLoop.cpp:551
bool HasPakMountFailed() const
Definition LaunchEngineLoop.cpp:552
static CORE_API bool Token(const TCHAR *&Str, TCHAR *Result, int32 MaxLen, bool bUseEscape, const TCHAR SingleCharacterDelimiter=TEXT('\0'))
Definition Parse.cpp:846
static CORE_API bool Param(const TCHAR *Stream, const TCHAR *Param)
Definition Parse.cpp:325
static CORE_API bool Value(const TCHAR *Stream, const TCHAR *Match, FName &Name)
Definition Parse.cpp:584
int32 BlockBytes
Definition PixelFormat.h:470
Definition AndroidPlatformMemory.h:15
bool bForceQuitAfterEarlyReads
Definition LaunchEngineLoop.h:23
FScopedSlowTask * SlowTaskPtr
Definition LaunchEngineLoop.h:36
void Cleanup()
Definition LaunchEngineLoop.cpp:7095
bool bTokenDoesNotHaveDash
Definition LaunchEngineLoop.h:30
bool bIsPossiblyUnrecognizedCommandlet
Definition LaunchEngineLoop.h:31
bool bIsRegularClient
Definition LaunchEngineLoop.h:28
bool bWithConfigPatching
Definition LaunchEngineLoop.h:24
FString Token
Definition LaunchEngineLoop.h:33
bool bDumpEarlyPakFileReads
Definition LaunchEngineLoop.h:22
bool bDumpEarlyConfigReads
Definition LaunchEngineLoop.h:21
FString CommandletCommandLine
Definition LaunchEngineLoop.h:34
bool bHasEditorToken
Definition LaunchEngineLoop.h:27
static PROJECTS_API FString GetExtension()
Definition ProjectDescriptor.cpp:350
Definition DynamicRHI.h:1440
Definition ScopedSlowTask.h:32
static RENDERCORE_API bool OpenLibrary(FString const &Name, FString const &Directory, bool bMonolithicOnly=false)
Definition ShaderCodeLibrary.cpp:4339
static RENDERCORE_API void Shutdown()
Definition ShaderCodeLibrary.cpp:4140
static RENDERCORE_API void InitForRuntime(EShaderPlatform ShaderPlatform)
Definition ShaderCodeLibrary.cpp:4076
static RENDERCORE_API void PreInit()
Definition ShaderCodeLibrary.cpp:4070
Definition ShaderCompiler.h:799
Definition StackTracker.h:19
Definition ContentStreaming.h:665
Definition Timespan.h:76
static FTimespan FromSeconds(double Seconds)
Definition Timespan.h:673
bool bIsEmbedded
Definition CoreGlobals.h:179
static CORE_API void SetGracefulTerminationHandler()
Definition WindowsPlatformMisc.cpp:1048
Definition Engine.h:334
virtual IConsoleVariable * FindConsoleVariable(const TCHAR *Name, bool bTrackFrequentCalls=true) const =0
TConsoleVariableData< int32 > * FindTConsoleVariableDataInt(const TCHAR *Name) const
Definition IConsoleManager.h:1203
virtual void CallAllConsoleVariableSinks()=0
static IConsoleManager & Get()
Definition IConsoleManager.h:1270
static ENGINE_API bool HasShutdown()
Definition ContentStreaming.cpp:371
static ENGINE_API struct FStreamingManagerCollection & Get()
Definition ContentStreaming.cpp:332
static ENGINE_API struct FStreamingManagerCollection * Get_Concurrent()
Definition ContentStreaming.cpp:350
static ENGINE_API void Shutdown()
Definition ContentStreaming.cpp:362
static int32 Snprintf(CharType *Dest, int32 DestSize, const FmtType &Fmt, Types... Args)
Definition CString.h:581
static UE_FORCEINLINE_HINT int32 Strcmp(const CharType *String1, const CharType *String2)
Definition CString.h:1018
static UE_FORCEINLINE_HINT CharType * Strcpy(CharType *Dest, const CharType *Src)
Definition CString.h:977
static const CharType * Strfind(const CharType *Str, const CharType *Find, bool bSkipQuotedChars=false)
Definition CString.h:641
static bool ToBool(const CharType *String)
Definition CString.h:515
static const CharType * Stristr(const CharType *Str, const CharType *Find)
Definition CString.h:799
static bool IsWhitespace(CharType Char)
Definition Char.h:282
Definition UnrealTemplate.h:341
Definition Optional.h:131
constexpr OptionalType & GetValue()
Definition Optional.h:443
constexpr bool IsSet() const
Definition Optional.h:69
Definition LightweightStats.h:416
static CORE_API bool EnabledForCommandlet()
Definition StatsSystem.cpp:116
static CORE_API void AdvanceFrame(bool bDiscardCallstack, const FOnAdvanceRenderingThreadStats &AdvanceRenderingThreadStatsDelegate=FOnAdvanceRenderingThreadStats())
Definition StatsSystem.cpp:58
static CORE_API void Init()
Definition StatsSystem.cpp:44
static CORE_API void TickCommandletStats()
Definition StatsSystem.cpp:102