template<
typename StructType>
class TRenderThreadStruct< StructType >
Represents a struct with a lifetime that spans multiple render commands with scoped initialization and release on the render thread.
Example:
struct FMyStruct : public FRenderThreadStructBase { FInitializer { int32 Foo; int32 Bar; };
FMyStruct(const FInitializer& InInitializer) : Initializer(InInitializer) { // Called immediately by TRenderThreadStruct when created. }
~FMyStruct() { // Called on the render thread when TRenderThreadStruct goes out of scope. }
void InitRHI(FRHICommandListImmediate& RHICmdList) { // Called on the render thread by TRenderThreadStruct when created. }
void ReleaseRHI(FRHICommandListImmediate& RHICmdList) { // Called on the render thread when TRenderThreadStruct goes out of scope. }
FInitializer Initializer; };
// On Main Thread
{ TRenderThreadStruct<FMyStruct> MyStruct(FMyStruct::FInitializer{1, 2});
ENQUEUE_RENDER_COMMAND(CommandA)[MyStruct = MyStruct.Get()](FRHICommandListImmediate& RHICmdList) { // Do something with MyStruct. };
ENQUEUE_RENDER_COMMAND(CommandB)[MyStruct = MyStrucft.Get()](FRHICommandListImmediate& RHICmdList) { // Do something else with MyStruct. };
// MyStruct instance is automatically released and deleted on the render thread. }