UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
FODSCThread Class Reference

#include <ODSCThread.h>

+ Inheritance diagram for FODSCThread:

Public Member Functions

 FODSCThread (const FString &HostIP)
 
virtual ~FODSCThread ()
 
void StartThread ()
 
void StopThread ()
 
virtual void Tick () override final
 
void AddRequest (const TArray< FString > &MaterialsToCompile, const FString &ShaderTypesToLoad, EShaderPlatform ShaderPlatform, ERHIFeatureLevel::Type FeatureLevel, EMaterialQualityLevel::Type QualityLevel, ODSCRecompileCommand RecompileCommandType, const FShaderCompilerFlags &ExtraCompilerFlags=FShaderCompilerFlags())
 
void AddShaderPipelineRequest (EShaderPlatform ShaderPlatform, ERHIFeatureLevel::Type FeatureLevel, EMaterialQualityLevel::Type QualityLevel, const FMaterial *Material, const FPrimitiveSceneInfo *PrimitiveSceneInfo, const FString &VertexFactoryName, const FString &PipelineName, const TArray< FString > &ShaderTypeNames, int32 PermutationId, const TArray< FShaderId > &RequestShaderIds)
 
void GetCompletedRequests (TArray< FODSCMessageHandler * > &OutCompletedRequests)
 
void Wakeup ()
 
void WaitUntilAllRequestsDone ()
 
bool GetPendingShaderData (bool &bOutIsConnectedToODSCServer, bool &bOutHasPendingGlobalShaders, uint32 &OutNumPendingMaterialsRecompile, uint32 &OutNumPendingMaterialsShaders) const
 
void ResetMaterialsODSCData (EShaderPlatform InShaderPlatform)
 
bool CheckIfRequestAlreadySent (const TArray< FShaderId > &RequestShaderIds, const FMaterial *Material) const
 
const FString & GetODSCHostIP () const
 
void UnregisterMaterialName (const FMaterial *Material)
 
void RegisterMaterialShaderMaps (const FString &MaterialName, const TArray< TRefCountPtr< FMaterialShaderMap > > &LoadedShaderMaps)
 
FMaterialShaderMapFindMaterialShaderMap (const FString &MaterialName, const FMaterialShaderMapId &ShaderMapId) const
 
void RetrieveMissedMaterials (TArray< FString > &OutMaterialPaths) const
 

Protected Member Functions

virtual bool Init () override
 
virtual uint32 Run () override final
 
virtual void Stop () override
 
virtual void Exit () override
 

Protected Attributes

FThreadSafeCounter ExitRequest
 

Detailed Description

Manages ODSC thread Handles sending requests to the cook on the fly server and communicating results back to the Game Thread.

Constructor & Destructor Documentation

◆ FODSCThread()

FODSCThread::FODSCThread ( const FString &  HostIP)

◆ ~FODSCThread()

FODSCThread::~FODSCThread ( )
virtual

Member Function Documentation

◆ AddRequest()

void FODSCThread::AddRequest ( const TArray< FString > &  MaterialsToCompile,
const FString &  ShaderTypesToLoad,
EShaderPlatform  ShaderPlatform,
ERHIFeatureLevel::Type  FeatureLevel,
EMaterialQualityLevel::Type  QualityLevel,
ODSCRecompileCommand  RecompileCommandType,
const FShaderCompilerFlags ExtraCompilerFlags = FShaderCompilerFlags() 
)

Add a shader compile request to be processed by this thread.

Parameters
MaterialsToCompile- List of material names to submit compiles for.
ShaderTypesToLoad- List of shader types to submit compiles for.
ShaderPlatform- Which shader platform to compile for.
RecompileCommandType- Whether we should recompile changed or global shaders.
Returns
false if no longer needs ticking

◆ AddShaderPipelineRequest()

void FODSCThread::AddShaderPipelineRequest ( EShaderPlatform  ShaderPlatform,
ERHIFeatureLevel::Type  FeatureLevel,
EMaterialQualityLevel::Type  QualityLevel,
const FMaterial Material,
const FPrimitiveSceneInfo PrimitiveSceneInfo,
const FString &  VertexFactoryName,
const FString &  PipelineName,
const TArray< FString > &  ShaderTypeNames,
int32  PermutationId,
const TArray< FShaderId > &  RequestShaderIds 
)

Add a request to compile a pipeline (VS/PS) of shaders. The results are submitted and processed in an async manner.

Parameters
ShaderPlatform- Which shader platform to compile for.
FeatureLevel- Which feature level to compile for.
QualityLevel- Which material quality level to compile for.
MaterialName- The name of the material to compile.
VertexFactoryName- The name of the vertex factory type we should compile.
PipelineName- The name of the shader pipeline we should compile.
ShaderTypeNames- The shader type names of all the shader stages in the pipeline.
PermutationId- The permutation ID of the shader we should compile.
Returns
false if no longer needs ticking

◆ CheckIfRequestAlreadySent()

bool FODSCThread::CheckIfRequestAlreadySent ( const TArray< FShaderId > &  RequestShaderIds,
const FMaterial Material 
) const

◆ Exit()

void FODSCThread::Exit ( void  )
overrideprotectedvirtual

Exits the runnable object.

Called in the context of the aggregating thread to perform any cleanup.

See also
Init, Run, Stop

Reimplemented from FRunnable.

◆ FindMaterialShaderMap()

FMaterialShaderMap * FODSCThread::FindMaterialShaderMap ( const FString &  MaterialName,
const FMaterialShaderMapId ShaderMapId 
) const

◆ GetCompletedRequests()

void FODSCThread::GetCompletedRequests ( TArray< FODSCMessageHandler * > &  OutCompletedRequests)

Get completed requests. Clears internal arrays. Called on Game thread.

Parameters
OutCompletedRequestsarray of requests that have been completed

◆ GetODSCHostIP()

const FString & FODSCThread::GetODSCHostIP ( ) const
inline

◆ GetPendingShaderData()

bool FODSCThread::GetPendingShaderData ( bool bOutIsConnectedToODSCServer,
bool bOutHasPendingGlobalShaders,
uint32 OutNumPendingMaterialsRecompile,
uint32 OutNumPendingMaterialsShaders 
) const

◆ Init()

bool FODSCThread::Init ( void  )
overrideprotectedvirtual

Initializes the runnable object.

This method is called in the context of the thread object that aggregates this, not the thread that passes this runnable to a new thread.

Returns
True if initialization was successful, false otherwise
See also
Run, Stop, Exit

Reimplemented from FRunnable.

◆ RegisterMaterialShaderMaps()

void FODSCThread::RegisterMaterialShaderMaps ( const FString &  MaterialName,
const TArray< TRefCountPtr< FMaterialShaderMap > > &  LoadedShaderMaps 
)

◆ ResetMaterialsODSCData()

void FODSCThread::ResetMaterialsODSCData ( EShaderPlatform  InShaderPlatform)

◆ RetrieveMissedMaterials()

void FODSCThread::RetrieveMissedMaterials ( TArray< FString > &  OutMaterialPaths) const

◆ Run()

uint32 FODSCThread::Run ( )
finaloverrideprotectedvirtual

Runs the runnable object.

This is where all per object thread work is done. This is only called if the initialization was successful.

Returns
The exit code of the runnable object
See also
Init, Stop, Exit

Implements FRunnable.

◆ StartThread()

void FODSCThread::StartThread ( )

Start the ODSC thread.

◆ Stop()

void FODSCThread::Stop ( void  )
overrideprotectedvirtual

Stops the runnable object.

This is called if a thread is requested to terminate early.

See also
Init, Run, Exit

Reimplemented from FRunnable.

◆ StopThread()

void FODSCThread::StopThread ( )

Stop the ODSC thread. Blocks until thread has stopped.

◆ Tick()

void FODSCThread::Tick ( )
finaloverridevirtual

Implements FSingleThreadRunnable.

◆ UnregisterMaterialName()

void FODSCThread::UnregisterMaterialName ( const FMaterial Material)

◆ WaitUntilAllRequestsDone()

void FODSCThread::WaitUntilAllRequestsDone ( )

Wait until all added requests are processed. Must be called after Wakeup.

◆ Wakeup()

void FODSCThread::Wakeup ( )

Wakeup the thread to process requests.

Member Data Documentation

◆ ExitRequest

FThreadSafeCounter FODSCThread::ExitRequest
protected

signal request to stop and exit thread


The documentation for this class was generated from the following files: