18 static constexpr const char*
TagName =
"LowLevelTasksLinear";
23 namespace TTaskDelegate_Impl
25 template<
typename ReturnType>
28 return *(
reinterpret_cast<ReturnType*
>(
uintptr_t(1)));
39 template<
typename =
void(), u
int32 = PLATFORM_CACHE_LINE_SIZE>
42 template<
uint32 TotalSize ,
typename ReturnType,
typename... ParamTypes>
45 template<
typename, u
int32>
56 virtual ReturnType Call(
void*, ParamTypes...)
const
59 return TTaskDelegate_Impl::MakeDummyValue<ReturnType>();
62 virtual ReturnType CallAndMove(ThisClass&,
void*,
uint32, ParamTypes...)
65 return TTaskDelegate_Impl::MakeDummyValue<ReturnType>();
73 virtual bool IsHeapAllocated()
const
79 virtual bool IsSet()
const
85 virtual uint32 DelegateSize()
const
98 ReturnType
Call(
void*, ParamTypes...)
const override
100 checkf(
false,
TEXT(
"trying to Call a dummy TaskDelegate"));
101 return TTaskDelegate_Impl::MakeDummyValue<ReturnType>();
104 ReturnType CallAndMove(ThisClass&,
void*,
uint32, ParamTypes...)
override
106 checkf(
false,
TEXT(
"trying to Call a dummy TaskDelegate"));
107 return TTaskDelegate_Impl::MakeDummyValue<ReturnType>();
114 bool IsHeapAllocated()
const override
119 bool IsSet()
const override
124 uint32 DelegateSize()
const override
130 template<
typename TCallableType,
bool HeapAllocated>
131 struct TTaskDelegateImpl;
133 template<
typename TCallableType>
136 template<
typename CallableT>
137 inline TTaskDelegateImpl(
CallableT&& Callable,
void* InlineData)
140 static_assert(std::is_same_v<ReturnType, decltype(Callable(UE::Core::Private::IsInvocable::DeclVal<ParamTypes>()...))>,
"TCallableType return type does not match");
159 inline ReturnType
Call(
void* InlineData, ParamTypes... Params)
const override
165 ReturnType CallAndMove(ThisClass& Destination,
void* InlineData,
uint32 DestInlineSize, ParamTypes... Params)
override
169 Move(Destination.CallableWrapper, Destination.InlineStorage, InlineData,
DestInlineSize);
174 void Destroy(
void* InlineData)
override
180 bool IsHeapAllocated()
const override
185 bool IsSet()
const override
190 uint32 DelegateSize()
const override
196 template<
typename TCallableType>
200 inline TTaskDelegateImpl(
void*
DstData,
void* SrcData)
206 template<
typename CallableT>
207 inline TTaskDelegateImpl(
CallableT&& Callable,
void* InlineData)
210 static_assert(std::is_same_v<ReturnType, decltype(Callable(UE::Core::Private::IsInvocable::DeclVal<ParamTypes>()...))>,
"TCallableType return type does not match");
212 static_assert(
alignof(
TCallableType) <= FLowLevelTasksBlockAllocationTag::Allocator::MaxAlignment);
224 inline ReturnType
Call(
void* InlineData, ParamTypes... Params)
const override
230 ReturnType CallAndMove(ThisClass& Destination,
void* InlineData,
uint32 DestInlineSize, ParamTypes... Params)
override
234 Move(Destination.CallableWrapper, Destination.InlineStorage, InlineData,
DestInlineSize);
239 void Destroy(
void* InlineData)
override
244 HeapPtr->DestructorType::~TCallableType();
248 bool IsHeapAllocated()
const override
253 bool IsSet()
const override
258 uint32 DelegateSize()
const override
267 static_assert(TotalSize % 8 == 0,
"Totalsize must be dividable by 8");
268 static_assert(TotalSize >= (
sizeof(
TTaskDelegateBase) +
sizeof(
void*)),
"Totalsize must be large enough to fit a vtable and pointer");
272 template<u
int32 SourceTotalSize>
275 template<u
int32 SourceTotalSize>
278 Other.GetWrapper()->Move(CallableWrapper, InlineStorage,
Other.InlineStorage, InlineStorageSize);
281 template<
typename CallableT>
297 GetWrapper()->Destroy(InlineStorage);
302 return GetWrapper()->Call(InlineStorage, Params...);
305 template<u
int32 DestTotalSize>
309 return GetWrapper()->CallAndMove(Destination, InlineStorage,
TTaskDelegate<ReturnType(ParamTypes...),
DestTotalSize>::InlineStorageSize, Params...);
312 template<u
int32 SourceTotalSize>
315 template<u
int32 SourceTotalSize>
318 GetWrapper()->
Destroy(InlineStorage);
319 Other.GetWrapper()->Move(CallableWrapper, InlineStorage,
Other.InlineStorage, InlineStorageSize);
323 template<
typename CallableT>
327 GetWrapper()->
Destroy(InlineStorage);
341 GetWrapper()->Destroy(InlineStorage);
347 return GetWrapper()->IsHeapAllocated();
352 return GetWrapper()->IsSet();
357 return GetWrapper()->DelegateSize();
362 mutable char InlineStorage[InlineStorageSize];
#define checkSlow(expr)
Definition AssertionMacros.h:332
#define checkNoEntry()
Definition AssertionMacros.h:316
#define checkf(expr, format,...)
Definition AssertionMacros.h:315
AUTORTFM_INFER UE_FORCEINLINE_HINT constexpr auto Invoke(FuncType &&Func, ArgTypes &&... Args) -> decltype(((FuncType &&) Func)((ArgTypes &&) Args...))
Definition Invoke.h:44
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
return true
Definition ExternalRpcRegistry.cpp:601
#define UE_LAUNDER(x)
Definition Launder.h:8
#define ON_SCOPE_EXIT
Definition ScopeExit.h:73
void Move(T &A, typename TMoveSupportTraits< T >::Copy B)
Definition UnrealTemplate.h:24
UE_INTRINSIC_CAST UE_REWRITE constexpr std::remove_reference_t< T > && MoveTemp(T &&Obj) noexcept
Definition UnrealTemplate.h:520
memcpy(InputBufferBase, BinkBlocksData, BinkBlocksSize)
Definition TaskDelegate.h:44
TTaskDelegate()
Definition TaskDelegate.h:265
TTaskDelegate(TTaskDelegate< ReturnType(ParamTypes...), SourceTotalSize > &&Other)
Definition TaskDelegate.h:276
bool IsHeapAllocated() const
Definition TaskDelegate.h:345
void Destroy()
Definition TaskDelegate.h:339
ReturnType CallAndMove(TTaskDelegate< ReturnType(ParamTypes...), DestTotalSize > &Destination, ParamTypes... Params)
Definition TaskDelegate.h:306
TTaskDelegate(const TTaskDelegate< ReturnType(ParamTypes...), SourceTotalSize > &)=delete
bool IsSet() const
Definition TaskDelegate.h:350
ReturnType operator()(ParamTypes... Params) const
Definition TaskDelegate.h:300
~TTaskDelegate()
Definition TaskDelegate.h:295
TTaskDelegate(CallableT &&Callable)
Definition TaskDelegate.h:282
uint32 DelegateSize() const
Definition TaskDelegate.h:355
Definition TaskDelegate.h:40
Definition ConcurrentLinearAllocator.h:65
Definition ConcurrentLinearAllocator.h:190
static void Free(void *Pointer)
Definition ConcurrentLinearAllocator.h:485
ReturnType MakeDummyValue()
Definition TaskDelegate.h:26
void MakeDummyValue< void >()
Definition TaskDelegate.h:32
Definition Scheduler.cpp:25
FUniformParams Params
Definition MeshPaintVirtualTexture.cpp:162
VERSECOMPILER_API bool IsSet()
Definition CommandLine.cpp:63
@ false
Definition radaudio_common.h:23
Definition ConcurrentLinearAllocator.h:154
Definition TaskDelegate.h:13
static constexpr uint32 BlockSize
Definition TaskDelegate.h:14
static constexpr bool InlineBlockAllocation
Definition TaskDelegate.h:17
static constexpr bool RequiresAccurateSize
Definition TaskDelegate.h:16
static constexpr bool AllowOversizedBlocks
Definition TaskDelegate.h:15
static constexpr const char * TagName
Definition TaskDelegate.h:18
Definition IsInvocable.h:47