UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
AsyncCompilationHelpers.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2#pragma once
3
4#include "CoreMinimal.h"
5
7#include "Logging/LogMacros.h"
10
12
14{
15public:
20
22private:
23 FProgressNotificationHandle NotificationHandle;
25 int32 StartNumJobs;
26 FTextFormat AssetNameFormat;
27};
28
30
32{
33 class ICompilable
34 {
35 public:
36 inline virtual ~ICompilable() {};
37
38 /*
39 * Reschedules any async tasks to the given thread pool at the given priority.
40 */
41 virtual void Reschedule(FQueuedThreadPool* InThreadPool, EQueuedWorkPriority InPriority) = 0;
42
43 /*
44 * Returns true once async tasks are complete, false if timing out.
45 *
46 * Use a TimeLimitSeconds of 0 to poll for completion.
47 */
48 virtual bool WaitCompletionWithTimeout(float TimeLimitSeconds) = 0;
49 virtual FName GetName() = 0;
50 };
51
52 template <typename AsyncTaskType>
53 class TCompilableAsyncTask : public ICompilable
54 {
55 virtual AsyncTaskType* GetAsyncTask() = 0;
56
58 {
59 if (AsyncTaskType* AsyncTask = GetAsyncTask())
60 {
61 AsyncTask->Reschedule(InThreadPool, InPriority);
62 }
63 }
64
65 bool WaitCompletionWithTimeout(float TimeLimitSeconds) override
66 {
67 if (AsyncTaskType* AsyncTask = GetAsyncTask())
68 {
69 return AsyncTask->WaitCompletionWithTimeout(TimeLimitSeconds);
70 }
71 return true;
72 }
73 };
74
76 TFunctionRef<ICompilable& (int32 Index)> Getter,
77 int32 Num,
79 const FText& AssetType,
80 const FLogCategoryBase& LogCategory,
81#endif
82 TFunctionRef<void(ICompilable*)> PostCompileSingle
83 );
84
85#if WITH_EDITOR
86
88 {
89 public:
94
96 };
97
98 ENGINE_API void EnsureInitializedCVars(
99 const TCHAR* InName,
103
109 );
110
111 ENGINE_API void SaveStallStack(uint64 Cycles);
113
114#endif // WITH_EDITOR
115}
void AsyncTask(ENamedThreads::Type Thread, TUniqueFunction< void()> Function)
Definition Async.cpp:54
#define WITH_EDITOR
Definition Build.h:67
FPlatformTypes::TCHAR TCHAR
Either ANSICHAR or WIDECHAR, depending on whether the platform supports wide characters or the requir...
Definition Platform.h:1135
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
FPlatformTypes::uint64 uint64
A 64-bit unsigned integer.
Definition Platform.h:1117
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
#define DECLARE_LOG_CATEGORY_EXTERN(CategoryName, DefaultVerbosity, CompileTimeVerbosity)
Definition LogMacros.h:361
@ Num
Definition MetalRHIPrivate.h:234
EQueuedWorkPriority
Definition QueuedThreadPool.h:14
Definition AsyncCompilationHelpers.h:14
FAsyncCompilationNotification(FTextFormat InAssetNameFormat)
Definition AsyncCompilationHelpers.h:16
Definition IConsoleManager.h:2026
Definition NameTypes.h:617
Definition QueuedThreadPoolWrapper.h:44
Definition QueuedThreadPool.h:105
Definition Text.h:278
Definition Text.h:385
Definition IConsoleManager.h:1792
Definition AssetRegistryState.h:50
Definition AsyncCompilationHelpers.cpp:89
void FinishCompilation(TFunctionRef< ICompilable &(int32 Index)> Getter, int32 Num, TFunctionRef< void(ICompilable *)> PostCompileSingle)
Definition AsyncCompilationHelpers.cpp:90
IMAGECORE_API const TCHAR * GetName(Type Format)
Definition ImageCore.cpp:1378
U16 Index
Definition radfft.cpp:71
Definition LogCategory.h:21
Definition NotificationManager.h:23