Navigation
API > API/Runtime > API/Runtime/Engine
Manager of asynchronous and parallel shader compilation. This class contains an interface to enqueue and retreive asynchronous shader jobs, and manages a FShaderCompileThreadRunnable.
| Name | FShaderCompilingManager |
| Type | class |
| Header File | /Engine/Source/Runtime/Engine/Public/ShaderCompiler.h |
| Include Path | #include "ShaderCompiler.h" |
Syntax
class FShaderCompilingManager : private IAssetCompilingManager
Implements Interfaces
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
FShaderCompilingManager() |
ShaderCompiler.h |
Destructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
~FShaderCompilingManager() |
ShaderCompiler.h |
Enums
Public
| Name | Remarks |
|---|---|
| EDumpShaderDebugInfo |
Variables
Protected
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| AbsoluteShaderBaseWorkingDirectory | FString | Absolute version of ShaderBaseWorkingDirectory. | ShaderCompiler.h | |
| AbsoluteShaderDebugInfoDirectory | FString | Absolute path to the directory to dump shader debug info to. | ShaderCompiler.h | |
| AllJobs | FShaderCompileJobCollection | Collection of all outstanding jobs | ShaderCompiler.h | |
| bAllowAsynchronousShaderCompiling | bool | Whether to allow shaders to compile in the background or to block after each material. | ShaderCompiler.h | |
| bAllowCompilingThroughWorkers | bool | Whether to allow compiling shaders through the worker application, which allows multiple cores to be used. | ShaderCompiler.h | |
| bAllowForIncompleteShaderMaps | bool | If we are using ODSC (On Demand Shader Compilation) we should allow for incomplete maps to still be processed. | ShaderCompiler.h | |
| bCompilingDuringGame | bool | Tracks whether we are compiling while the game is running. | ShaderCompiler.h | |
| bDebugBreakOnPromptToRetryShaderCompile | bool | If enabled when we enter the prompt to retry we will break in the debugger if one is attached rather than prompting. | ShaderCompiler.h | |
| bIsEngineLoopInitialized | bool | Cached Engine loop initialization state | ShaderCompiler.h | |
| bLogJobCompletionTimes | bool | Whether to log out shader job completion times on the worker thread. | ShaderCompiler.h | |
| bNoShaderCompilation | bool | Opt out of material shader compilation and instead place an empty shader map. | ShaderCompiler.h | |
| bPromptToRetryFailedShaderCompiles | bool | Whether to ask to retry a failed shader compile error. | ShaderCompiler.h | |
| BuildDistributionController | IDistributedBuildController * | Interface to the build distribution controller (XGE/SN-DBS) | ShaderCompiler.h | |
| bUseOnlyDistributedCompilationThread | bool | Whether shaders are compiled exclusively through the distributed shader controller and no local shader compiling thread is allocated. | ShaderCompiler.h | |
| CompileQueueSection | FCriticalSection | Critical section used to gain access to the variables above that are shared by both the main thread and the FShaderCompileThreadRunnable. | ShaderCompiler.h | |
| DirectoryWatcherHandles | TMap< FString, FDelegateHandle > | ShaderCompiler.h | ||
| LastNumRemainingAssets | int32 | Last value of GetNumRemainingAssets | ShaderCompiler.h | |
| MaxShaderJobBatchSize | int32 | Largest number of jobs that can be put in the same batch. | ShaderCompiler.h | |
| Notification | TUniquePtr< FAsyncCompilationNotification > | Used to show a notification accompanying progress. | ShaderCompiler.h | |
| NumDumpedShaderSources | std::atomic< int32 > | Number of preprocessed shader sources that are dumped due to a crash of the shader compiler. | ShaderCompiler.h | |
| NumExternalJobs | int32 | Number of jobs currently being compiled. | ShaderCompiler.h | |
| NumShaderCompilingThreads | uint32 | Number of busy threads to use for shader compiling while loading. | ShaderCompiler.h | |
| NumShaderCompilingThreadsDuringGame | uint32 | Number of busy threads to use for shader compiling while in game. | ShaderCompiler.h | |
| NumSingleThreadedRunsBeforeRetry | int32 | Number of runs through single-threaded compiling before we can retry to compile through workers. | ShaderCompiler.h | |
| OutOfMemoryDelegateHandle | FDelegateHandle | Delegate handle for delegate used to report memory usage during out-of-memory conditions. | ShaderCompiler.h | |
| PendingFinalizeShaderMaps | TMap< int32, FShaderMapFinalizeResults > | Map from shader map id to results being finalized. | ShaderCompiler.h | |
| ProcessGameThreadTargetTime | float | Target execution time for ProcessAsyncResults. | ShaderCompiler.h | |
| ProcessId | uint32 | Process Id of UE. | ShaderCompiler.h | |
| ShaderBaseWorkingDirectory | FString | Base directory where temporary files are written out during multi core shader compiling. | ShaderCompiler.h | |
| ShaderCompileWorkerName | FString | Name of the shader worker application. | ShaderCompiler.h | |
| ShaderMapJobs | TMap< int32, FPendingShaderMapCompileResultsPtr > | Map from shader map Id to the compile results for that map, used to gather compiled results. | ShaderCompiler.h | |
| SuppressedShaderPlatforms | uint64 | Tracks which opt-in shader platforms have their warnings suppressed. | ShaderCompiler.h | |
| Threads | TArray< TUniquePtr< FShaderCompileThreadRunnableBase > > | The threads spawned for shader compiling. | ShaderCompiler.h | |
| WorkerCrashLogBaseDirectory | FString | If dumping crash logs for workers is enabled and an absolute path is used (i.e. -AbsLog), this contains the base directory path. | ShaderCompiler.h | |
| WorkersBusyTime | double | Tracks the total time that shader compile workers have been busy since startup. | ShaderCompiler.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
bool AllowAsynchronousShaderCompiling() |
ShaderCompiler.h | ||
bool AreWarningsSuppressed
(
const EShaderPlatform Platform |
ShaderCompiler.h | ||
void CancelCompilation
(
const TCHAR* MaterialName, |
Removes all outstanding compile jobs for the passed shader maps. | ShaderCompiler.h | |
FString CreateShaderDebugInfoPath
(
const FShaderCompilerInput& ShaderCompilerInput |
ShaderCompiler.h | ||
void DumpDebugInfoForEachPendingJob
(
const FShaderCompileJobCallback& PendingJobCallback |
Dumps the debug information for each pending job for which PendingJobCallback returns true. | ShaderCompiler.h | |
void FinishCompilation
(
const TCHAR* MaterialName, |
Blocks until completion of the requested shader maps. | ShaderCompiler.h | |
const FString & GetAbsoluteShaderDebugInfoDirectory() |
ShaderCompiler.h | ||
FShaderCompilerMemoryLimits GetCurrentMemoryLimits() |
ShaderCompiler.h | ||
EDumpShaderDebugInfo GetDumpShaderDebugInfo() |
ShaderCompiler.h | ||
EShaderDebugInfoFlags GetDumpShaderDebugInfoFlags() |
ShaderCompiler.h | ||
FShaderCompileMemoryUsage GetExternalMemoryUsage() |
Returns the current memory usage of external local compilation processes in bytes. | ShaderCompiler.h | |
void GetLocalStats
(
FShaderCompilerStats& OutStats |
Retrieve compiler statistics for all compilation done in this process. | ShaderCompiler.h | |
int32 GetNumLocalWorkers() |
Returns the (current) number of local workers. | ShaderCompiler.h | |
int32 GetNumOutstandingJobs() |
ShaderCompiler.h | ||
int32 GetNumPendingJobs() |
ShaderCompiler.h | ||
int32 GetNumRemainingJobs () |
Returns the number of outstanding compile jobs. | ShaderCompiler.h | |
bool HasShaderJobs() |
Return true if we have shader jobs in any state shader jobs are removed when they are applied to the gamethreadshadermap accessable from gamethread | ShaderCompiler.h | |
bool IgnoreAllThrottling () |
Returns whether normal throttling settings should be ignored because shader compilation is at the moment the only action blocking the critical path. | ShaderCompiler.h | |
void IncrementNumDumpedShaderSources() |
ShaderCompiler.h | ||
bool IsCompiling () |
Returns whether async compiling is happening. | ShaderCompiler.h | |
bool IsCompilingShaderMap
(
uint32 Id |
ShaderCompiler.h | ||
| Returns whether shaders are exclusively compiled through distributed controller, i.e. no local shader compiling thread is allocated. | ShaderCompiler.h | ||
bool IsRemoteCompilingEnabled () |
Returns whether remote compiling is enabled. | ShaderCompiler.h | |
bool IsShaderCompilationSkipped() |
ShaderCompiler.h | ||
void 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). | ShaderCompiler.h | |
void OnMachineResourcesChanged
(
int32 NumberOfCores, |
Called by external systems that have updated the number of worker threads available. | ShaderCompiler.h | |
FShaderPipelineCompileJob * PreparePipelineCompileJob
(
uint32 Id, |
ShaderCompiler.h | ||
FShaderCompileJob * PrepareShaderCompileJob
(
uint32 Id, |
Prepares a job of the given type for compilation. | ShaderCompiler.h | |
void PrintStats() |
Prints stats related to shader compilation to the log. | ShaderCompiler.h | |
void ProcessAsyncResults
(
bool bLimitExecutionTime, |
Version of ProcessAsyncResults that specifies use of ProcessGameThreadTargetTime for the timeslice. | ShaderCompiler.h | |
void ProcessAsyncResults
(
float TimeSlice, |
Processes completed asynchronous shader maps, and assigns them to relevant materials. | ShaderCompiler.h | |
void ProcessFinishedJob
(
FShaderCommonCompileJob* FinishedJob, |
This is an entry point for all jobs that have finished the compilation. | ShaderCompiler.h | |
void ProcessFinishedJob
(
FShaderCommonCompileJob* FinishedJob |
ShaderCompiler.h | ||
void SetAllowForIncompleteShaderMaps
(
bool toggle |
ShaderCompiler.h | ||
void SetExternalJobs
(
int32 NumJobs |
ShaderCompiler.h | ||
void SetTargetMemoryLimitInMiB
(
int32 NewLimit |
ShaderCompiler.h | ||
| Returns whether to display a notification that shader compiling is happening in the background. | ShaderCompiler.h | ||
bool ShouldRecompileToDumpShaderDebugInfo
(
const FShaderCompileJob& Job |
ShaderCompiler.h | ||
bool ShouldRecompileToDumpShaderDebugInfo
(
const FShaderCompilerInput& Input, |
ShaderCompiler.h | ||
void SkipShaderCompilation
(
bool toggle |
ShaderCompiler.h | ||
void SubmitJobs
(
TArray< FShaderCommonCompileJobPtr >& NewJobs, |
Adds shader jobs to be asynchronously compiled. | ShaderCompiler.h | |
void SuppressWarnings
(
const EShaderPlatform Platform |
ShaderCompiler.h |
Overridden from IAssetCompilingManager
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual void FinishAllCompilation () |
Blocks until completion of all async shader compiling, and assigns shader maps to relevant materials. | ShaderCompiler.h | |
virtual void Shutdown () |
Shutdown the shader compiler manager, this will shutdown immediately and not process any more shader compile requests. | ShaderCompiler.h |
Static
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
static FName GetStaticAssetTypeName() |
Get the name of the asset type this compiler handles | ShaderCompiler.h | |
static bool IsShaderCompilerWorkerRunning
(
FProcHandle& WorkerHandle |
Returns true if the given shader compile worker is still running. | ShaderCompiler.h |