![]() |
UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
|
#include <ShaderCompiler.h>
Inheritance diagram for FShaderCompilingManager:Public Types | |
| enum class | EDumpShaderDebugInfo : int32 { Never = 0 , Always = 1 , OnError = 2 , OnErrorOrWarning = 3 } |
Static Public Member Functions | |
| static ENGINE_API FName | GetStaticAssetTypeName () |
| static bool | IsShaderCompilerWorkerRunning (FProcHandle &WorkerHandle) |
Friends | |
| class | FShaderCompileThreadRunnableBase |
| class | FShaderCompileThreadRunnable |
| class | FShaderCompileDistributedThreadRunnable_Interface |
| class | FShaderCompileFASTBuildThreadRunnable |
Manager of asynchronous and parallel shader compilation. This class contains an interface to enqueue and retreive asynchronous shader jobs, and manages a FShaderCompileThreadRunnable.
|
strong |
| FShaderCompilingManager::FShaderCompilingManager | ( | ) |
| FShaderCompilingManager::~FShaderCompilingManager | ( | ) |
|
inline |
|
inline |
| void FShaderCompilingManager::CancelCompilation | ( | const TCHAR * | MaterialName, |
| const TArray< int32 > & | ShaderMapIdsToCancel | ||
| ) |
Removes all outstanding compile jobs for the passed shader maps.
| FString FShaderCompilingManager::CreateShaderDebugInfoPath | ( | const FShaderCompilerInput & | ShaderCompilerInput | ) | const |
| void FShaderCompilingManager::DumpDebugInfoForEachPendingJob | ( | const FShaderCompileJobCallback & | PendingJobCallback | ) | const |
Dumps the debug information for each pending job for which PendingJobCallback returns true.
|
overridevirtual |
Blocks until completion of all async shader compiling, and assigns shader maps to relevant materials. This should be called before exit if the DDC needs to be made up to date.
Implements IAssetCompilingManager.
| void FShaderCompilingManager::FinishCompilation | ( | const TCHAR * | MaterialName, |
| const TArray< int32 > & | ShaderMapIdsToFinishCompiling | ||
| ) |
Blocks until completion of the requested shader maps.
This will not assign the shader map to any materials, the caller is responsible for that.
|
inline |
| ENGINE_API FShaderCompilerMemoryLimits FShaderCompilingManager::GetCurrentMemoryLimits | ( | ) | const |
| FShaderCompilingManager::EDumpShaderDebugInfo FShaderCompilingManager::GetDumpShaderDebugInfo | ( | ) | const |
| EShaderDebugInfoFlags FShaderCompilingManager::GetDumpShaderDebugInfoFlags | ( | ) | const |
| FShaderCompileMemoryUsage FShaderCompilingManager::GetExternalMemoryUsage | ( | ) |
Returns the current memory usage of external local compilation processes in bytes.
| void FShaderCompilingManager::GetLocalStats | ( | FShaderCompilerStats & | OutStats | ) | const |
Retrieve compiler statistics for all compilation done in this process. Note that this will not include stats for any compilation that occurs in worker processes in a multiprocess cook.
|
inline |
Returns the (current) number of local workers.
| int32 FShaderCompilingManager::GetNumOutstandingJobs | ( | ) | const |
| int32 FShaderCompilingManager::GetNumPendingJobs | ( | ) | const |
|
inline |
Returns the number of outstanding compile jobs. Note: This is dependent on NumOutstandingJobs which is updated from another thread, so the results are non-deterministic.
|
static |
Get the name of the asset type this compiler handles
|
inline |
return true if we have shader jobs in any state shader jobs are removed when they are applied to the gamethreadshadermap accessable from gamethread
|
inline |
Returns whether normal throttling settings should be ignored because shader compilation is at the moment the only action blocking the critical path. An example of such situation is startup compilation of global shaders and default materials, but there may be more cases like that.
|
inline |
|
inline |
Returns whether async compiling is happening. Note: This is dependent on NumOutstandingJobs which is updated from another thread, so the results are non-deterministic.
|
inline |
Returns whether shaders are exclusively compiled through distributed controller, i.e. no local shader compiling thread is allocated. If this is true, the distributed controller must not refuse job batches below a minimum threshold, otherwise those jobs will never get picked up.
|
inline |
Returns whether remote compiling is enabled. Otherwise, only the local machine is used for shader compilation. This depends on command line argument '-NoRemoteShaderCompile', CVar 'r.ShaderCompiler.AllowDistributedCompilation', and whether the target platform supports remote compilin; see ITargetPlatform::CanSupportRemoteShaderCompile().
|
inline |
|
static |
Returns true if the given shader compile worker is still running.
| void FShaderCompilingManager::OnDistributedShaderCompilingChanged | ( | ) |
Called when CVars are changed at runtime that determine whether or not the distributed shader compiler supports local workers (e.g. 'r.XGEController.AvoidUsingLocalMachine' can be changed at runtime).
| void FShaderCompilingManager::OnMachineResourcesChanged | ( | int32 | NumberOfCores, |
| int32 | NumberOfCoresIncludingHyperthreads | ||
| ) |
Called by external systems that have updated the number of worker threads available.
| FShaderPipelineCompileJob * FShaderCompilingManager::PreparePipelineCompileJob | ( | uint32 | Id, |
| const FShaderPipelineCompileJobKey & | Key, | ||
| EShaderCompileJobPriority | Priority | ||
| ) |
| FShaderCompileJob * FShaderCompilingManager::PrepareShaderCompileJob | ( | uint32 | Id, |
| const FShaderCompileJobKey & | Key, | ||
| EShaderCompileJobPriority | Priority | ||
| ) |
Prepares a job of the given type for compilation. If a job with the given Id/Key already exists, it will attempt to adjust to the higher priority if possible, and nullptr will be returned. If a non-nullptr is returned, the given job should be filled out with relevant information, then passed to SubmitJobs() when ready
| void FShaderCompilingManager::PrintStats | ( | ) |
Prints stats related to shader compilation to the log.
| void FShaderCompilingManager::ProcessAsyncResults | ( | bool | bLimitExecutionTime, |
| bool | bBlockOnGlobalShaderCompletion | ||
| ) |
Version of ProcessAsyncResults that specifies use of ProcessGameThreadTargetTime for the timeslice.
| void FShaderCompilingManager::ProcessAsyncResults | ( | float | TimeSlice, |
| bool | bBlockOnGlobalShaderCompletion | ||
| ) |
Processes completed asynchronous shader maps, and assigns them to relevant materials.
| TimeSlice | - When more than 0, ProcessAsyncResults will be bandwidth throttled by the given timeslice, to limit hitching. ProcessAsyncResults will then have to be called often to finish all shader maps (eg from Tick). Otherwise, all compiled shader maps will be processed. |
| bBlockOnGlobalShaderCompletion | - When enabled, ProcessAsyncResults will block until global shader maps are complete. This must be done before using global shaders for rendering. |
|
inline |
| void FShaderCompilingManager::ProcessFinishedJob | ( | FShaderCommonCompileJob * | FinishedJob, |
| EShaderCompileJobStatus | Status | ||
| ) |
This is an entry point for all jobs that have finished the compilation. Can be called from multiple threads.
| ENGINE_API void FShaderCompilingManager::SetTargetMemoryLimitInMiB | ( | int32 | NewLimit | ) |
|
inline |
Returns whether to display a notification that shader compiling is happening in the background. Note: This is dependent on NumOutstandingJobs which is updated from another thread, so the results are non-deterministic.
| bool FShaderCompilingManager::ShouldRecompileToDumpShaderDebugInfo | ( | const FShaderCompileJob & | Job | ) | const |
| bool FShaderCompilingManager::ShouldRecompileToDumpShaderDebugInfo | ( | const FShaderCompilerInput & | Input, |
| const FShaderCompilerOutput & | Output, | ||
| bool | bSucceeded | ||
| ) | const |
|
overridevirtual |
Shutdown the shader compiler manager, this will shutdown immediately and not process any more shader compile requests.
Shutdown the shader compile manager this function should be used when ending the game to shutdown shader compile threads will not complete current pending shader compilation
Implements IAssetCompilingManager.
| void FShaderCompilingManager::SubmitJobs | ( | TArray< FShaderCommonCompileJobPtr > & | NewJobs, |
| const FString | MaterialBasePath, | ||
| FString | PermutationString = FString("") |
||
| ) |
Adds shader jobs to be asynchronously compiled. FinishCompilation or ProcessAsyncResults must be used to get the results.
|
inline |
|
friend |
|
friend |
|
friend |
|
friend |