Skip to content
SiteEmail

UMultithreadAwareCompositorWrapper

This class utilizes the Decorator pattern and it detects whether the provided CompositorInterface APIs invoke on the Game Thread or a Worker Thread. If the Compositor API’s are invoked on the Game Thread - the wrapper executes them on the Game Thread directly. If your cohtml::View runs in Concurrent Advance mode, the Compositor APIs will invoke on a Worker Thread and this wrapper will add them to a Queue with pending compositions which will be processed on the Game Thread.

#include <RenoirSublayerCompositor.h>

Inherits from UObject, ICompositorInterfaceUnreal

Name
virtual voidOnDrawSubLayer(const renoir::ISubLayerCompositor::DrawData & DrawData) override
Called on a Worker Thread (task created by the View Layout) Since we cannot create/update textures there, we just save them for processing on the Game Thread.
virtual voidOnCompositionAdded(unsigned ViewId, const char * CompositionId, void * Metadata) override
Called on the Game Thread whenever a new composition is found in HTML Should initialize the relevant materials that the texture will be drawn into.
virtual voidOnCompositionVisibility(unsigned , const char * , void * , bool ) override
Called on the Game Thread whenever the visibility of the composition has changed.
virtual voidOnCompositionTransform(unsigned , const char * , void * , const renoir::float4x4 & ) override
Called on the Game Thread whenever the transform of the composition has changed.
virtual voidOnCompositionRemoved(unsigned ViewId, const char * CompositionId, void * Metadata) override
Called on the Game Thread whenever a new composition is removed from HTML Should destroy the relevant materials that the texture will be drawn into.
virtual voidCreateCompositions(uint32 ViewFrameId) override
Executed during AdvanceCompositor after we have waited for cohtml::View::Advance and Layout.
virtual voidSetViewSize(int32_t Width, int32_t Height) override
Helper method for Compositors that care about size.
virtual voidProcessFrame_RT(uint32_t ViewFrameId) override
Called on the Render Thread at the end of the frame after a View paint.
virtual voidProcessDrawData(const FRenoirDrawData & DrawData, uint32 ViewFrameId) override
Called on the Game Thread, used to create/update textures based on the draw data received for them Should be overridden by child classes depending on where/how they want to draw the textures.
virtual boolShouldSkipFrame() override
Helper method to combine multiple conditions to determine if the current Compositor frame should be skipped.
virtual boolHasCompositions() override
Helper method to save on computation when there are no compositions.
virtual boolIsValidObject() override
Helper method to catch some invalid creation/destruction edge cases.
virtual voidPrepareForAdvance(uint32 ViewFrameId) override
Called on the Game Thread after a View gets advanced.
virtual FCriticalSection &GetCriticalSectionFrames() override
virtual const TMap< FString, FRenoirDrawData > &GetRenoirDrawDataMap() const override
voidSetCompositorInterface(UObject * CompositorOwner, ICompositorInterfaceUnreal * CompositorInterfaceObject)
UObject *GetCompositorUObject()

Public Functions inherited from ICompositorInterfaceUnreal

Name
voidAdvanceCompositor(uint32 ViewFrameId)
Must be called after ensuring that View Layout tasks are completed.
virtual voidPrepareAllMeshMaterial(uint32_t ViewFrameId)
virtual voidProcessRenderData(const FRenderData & RenderData)

Protected Functions inherited from ICompositorInterfaceUnreal

Name
voidUpdateRenderData(const FRenoirDrawData & DrawData, UTextureRenderTarget2D * Texture, IRenderingBackend * InterfaceBackend, uint32 ViewFrameId)

Protected Attributes inherited from ICompositorInterfaceUnreal

Name
FCriticalSectionCriticalSectionFrames
uint32CurrentCompositorFrameId
TSet< uint32 >Frames
TMap< uint32, TArray< FRenderData > >RenderDataInfosMap
TMap< FString, FRenoirDrawData >RenoirDrawDataMap
boolbNewCompositionsReceived
virtual void OnDrawSubLayer(
const renoir::ISubLayerCompositor::DrawData & DrawData
) override

Called on a Worker Thread (task created by the View Layout) Since we cannot create/update textures there, we just save them for processing on the Game Thread.

Reimplements: ICompositorInterfaceUnreal::OnDrawSubLayer

virtual void OnCompositionAdded(
unsigned ViewId,
const char * CompositionId,
void * Metadata
) override

Called on the Game Thread whenever a new composition is found in HTML Should initialize the relevant materials that the texture will be drawn into.

Reimplements: ICompositorInterfaceUnreal::OnCompositionAdded

virtual void OnCompositionVisibility(
unsigned ,
const char * ,
void * ,
bool
) override

Called on the Game Thread whenever the visibility of the composition has changed.

Reimplements: ICompositorInterfaceUnreal::OnCompositionVisibility

virtual void OnCompositionTransform(
unsigned ,
const char * ,
void * ,
const renoir::float4x4 &
) override

Called on the Game Thread whenever the transform of the composition has changed.

Reimplements: ICompositorInterfaceUnreal::OnCompositionTransform

virtual void OnCompositionRemoved(
unsigned ViewId,
const char * CompositionId,
void * Metadata
) override

Called on the Game Thread whenever a new composition is removed from HTML Should destroy the relevant materials that the texture will be drawn into.

Reimplements: ICompositorInterfaceUnreal::OnCompositionRemoved

virtual void CreateCompositions(
uint32 ViewFrameId
) override

Executed during AdvanceCompositor after we have waited for cohtml::View::Advance and Layout.

Reimplements: ICompositorInterfaceUnreal::CreateCompositions

virtual void SetViewSize(
int32_t Width,
int32_t Height
) override

Helper method for Compositors that care about size.

Reimplements: ICompositorInterfaceUnreal::SetViewSize

virtual void ProcessFrame_RT(
uint32_t ViewFrameId
) override

Called on the Render Thread at the end of the frame after a View paint.

Reimplements: ICompositorInterfaceUnreal::ProcessFrame_RT

virtual void ProcessDrawData(
const FRenoirDrawData & DrawData,
uint32 ViewFrameId
) override

Called on the Game Thread, used to create/update textures based on the draw data received for them Should be overridden by child classes depending on where/how they want to draw the textures.

Reimplements: ICompositorInterfaceUnreal::ProcessDrawData

virtual bool ShouldSkipFrame() override

Helper method to combine multiple conditions to determine if the current Compositor frame should be skipped.

Reimplements: ICompositorInterfaceUnreal::ShouldSkipFrame

virtual bool HasCompositions() override

Helper method to save on computation when there are no compositions.

Reimplements: ICompositorInterfaceUnreal::HasCompositions

virtual bool IsValidObject() override

Helper method to catch some invalid creation/destruction edge cases.

Reimplements: ICompositorInterfaceUnreal::IsValidObject

virtual void PrepareForAdvance(
uint32 ViewFrameId
) override

Called on the Game Thread after a View gets advanced.

Reimplements: ICompositorInterfaceUnreal::PrepareForAdvance

virtual FCriticalSection & GetCriticalSectionFrames() override

Reimplements: ICompositorInterfaceUnreal::GetCriticalSectionFrames

virtual const TMap< FString, FRenoirDrawData > & GetRenoirDrawDataMap() const override

Reimplements: ICompositorInterfaceUnreal::GetRenoirDrawDataMap

void SetCompositorInterface(
UObject * CompositorOwner,
ICompositorInterfaceUnreal * CompositorInterfaceObject
)
UObject * GetCompositorUObject()