![]() |
UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
|
#include "ShaderCompiler.h"#include "ShaderCompiler/ShaderCompilerInternal.h"#include "ShaderCompilerPrivate.h"#include "AsyncCompilationHelpers.h"#include "AssetCompilingManager.h"#include "ClearReplacementShaders.h"#include "ComponentRecreateRenderStateContext.h"#include "Components/PrimitiveComponent.h"#include "DataDrivenShaderPlatformInfo.h"#include "DistributedBuildControllerInterface.h"#include "EditorSupportDelegates.h"#include "Engine/RendererSettings.h"#include "Features/IModularFeatures.h"#include "Interfaces/IShaderFormat.h"#include "Interfaces/ITargetPlatform.h"#include "Interfaces/ITargetPlatformManagerModule.h"#include "Internationalization/LocKeyFuncs.h"#include "Logging/StructuredLog.h"#include "MaterialShared.h"#include "Materials/Material.h"#include "Materials/MaterialInstance.h"#include "Misc/ConfigCacheIni.h"#include "Misc/CoreDelegates.h"#include "Misc/FeedbackContext.h"#include "Misc/FileHelper.h"#include "Misc/MessageDialog.h"#include "Misc/ScopedSlowTask.h"#include "Modules/ModuleManager.h"#include "ObjectCacheContext.h"#include "ProfilingDebugging/CookStats.h"#include "ProfilingDebugging/DiagnosticTable.h"#include "ProfilingDebugging/LoadTimeTracker.h"#include "ProfilingDebugging/StallDetector.h"#include "RenderUtils.h"#include "SceneInterface.h"#include "SceneManagement.h"#include "Serialization/CompactBinaryWriter.h"#include "Serialization/MemoryReader.h"#include "Serialization/NameAsStringProxyArchive.h"#include "ShaderCodeLibrary.h"#include "ShaderSerialization.h"#include "ShaderDiagnostics.h"#include "ShaderPlatformCachedIniValue.h"#include "StaticBoundShaderState.h"#include "StereoRenderUtils.h"#include "Tasks/Task.h"#include "UObject/DevObjectVersion.h"#include "UObject/UObjectIterator.h"#include "Math/UnitConversion.h"#include "UnrealEngine.h"#include "ColorManagement/ColorSpace.h"#include "SceneTexturesConfig.h"#include "PSOPrecacheMaterial.h"#include "Misc/PreLoadFile.h"#include "Serialization/LargeMemoryReader.h"Classes | |
| class | FRecompileShadersTimer |
Namespaces | |
| namespace | ShaderCompiler |
Macros | |
| #define | LOCTEXT_NAMESPACE "ShaderCompiler" |
| #define | DEBUG_SHADERCOMPILEWORKER 0 |
Variables | |
| int32 | GShaderCompilerAllowDistributedCompilation = 1 |
| int32 | GMaxNumDumpedShaderSources = 10 |
| int32 | GSShaderCheckLevel = 1 |
| bool | GDebugDumpWorkerCrashLog = false |
| FGlobalShaderMap * | GGlobalShaderMap_DeferredDeleteCopy [SP_NumPlatforms] = {nullptr} |
| bool | GRetryShaderCompilation = true |
| int32 | GCreateShadersOnLoad = 0 |
| FShaderCompilingManager * | GShaderCompilingManager = nullptr |
| const ITargetPlatform * | GGlobalShaderTargetPlatform [SP_NumPlatforms] = { nullptr } |
| #define DEBUG_SHADERCOMPILEWORKER 0 |
| #define LOCTEXT_NAMESPACE "ShaderCompiler" |
| bool AreShaderErrorsFatal | ( | ) |
| void BeginRecompileGlobalShaders | ( | const TArray< const FShaderType * > & | OutdatedShaderTypes, |
| const TArray< const FShaderPipelineType * > & | OutdatedShaderPipelineTypes, | ||
| EShaderPlatform | ShaderPlatform, | ||
| const ITargetPlatform * | TargetPlatform = nullptr, |
||
| const FShaderCompilerFlags & | InExtraCompilerFlags = {} |
||
| ) |
Begins recompiling the specified global shader types, and flushes their bound shader states. FinishRecompileGlobalShaders must be called after this and before using the global shaders for anything.
|
constexpr |
| void CompileGlobalShaderMap | ( | ERHIFeatureLevel::Type | InFeatureLevel, |
| bool | bRefreshShaderMap | ||
| ) |
| void CompileGlobalShaderMap | ( | EShaderPlatform | Platform, |
| bool | bRefreshShaderMap | ||
| ) |
| void CompileGlobalShaderMap | ( | EShaderPlatform | Platform, |
| const ITargetPlatform * | TargetPlatform, | ||
| bool | bRefreshShaderMap | ||
| ) |
| bool CreateShadersOnLoad | ( | ) |
| DEFINE_LOG_CATEGORY | ( | LogShaderCompilers | ) |
| void DumpShaderDDCKeyToFile | ( | const EShaderPlatform | InPlatform, |
| bool | bEditorOnly, | ||
| const TCHAR * | DebugGroupName, | ||
| const FString & | DDCKey | ||
| ) |
| void DumpShaderDDCKeyToFile | ( | const EShaderPlatform | InPlatform, |
| bool | bWithEditor, | ||
| const FString & | FileName, | ||
| const FString & | DDCKey | ||
| ) |
| void FinishRecompileGlobalShaders | ( | ) |
Finishes recompiling global shaders. Must be called after BeginRecompileGlobalShaders.
| const FGuid & GetGlobalShaderMapDDCGuid | ( | ) |
| const FGuid & GetMaterialShaderMapDDCGuid | ( | ) |
| void GetOutdatedShaderTypes | ( | TArray< const FShaderType * > & | OutdatedShaderTypes, |
| TArray< const FShaderPipelineType * > & | OutdatedShaderPipelineTypes, | ||
| TArray< const FVertexFactoryType * > & | OutdatedFactoryTypes | ||
| ) |
Returns whether all global shader types containing the substring are complete and ready for rendering. if type name is null, check everything
| bool IsGlobalShaderMapComplete | ( | const TCHAR * | TypeNameSubstring, |
| FGlobalShaderMap * | GlobalShaderMap, | ||
| EShaderPlatform | Platform, | ||
| FString * | FailureReason = nullptr |
||
| ) |
| LLM_DEFINE_TAG | ( | ShaderCompiler | ) |
| void LoadGlobalShadersForRemoteRecompile | ( | FArchive & | Ar, |
| EShaderPlatform | ShaderPlatform | ||
| ) |
Serializes a global shader map to an archive (used with recompiling shaders for a remote console)
|
extern |
| void PrecacheComputePipelineStatesForGlobalShaders | ( | ERHIFeatureLevel::Type | FeatureLevel, |
| const ITargetPlatform * | TargetPlatform | ||
| ) |
Precreates compute PSOs for global shaders. Separate from Compile/VerifyGlobalShaders to avoid blocking loads.
| void ProcessCookOnTheFlyShaders | ( | bool | bReloadGlobalShaders, |
| const TArray< uint8 > & | MeshMaterialMaps, | ||
| const TArray< FString > & | MaterialsToLoad, | ||
| const TArray< uint8 > & | GlobalShaderMap | ||
| ) |
Handles serializing in MeshMaterialMaps or GlobalShaderMap from a CookOnTheFly command and applying them to the in-memory shadermaps.
| MeshMaterialMaps | Byte array that contains the serialized material shadermap from across the network. |
| MaterialsToLoad | The materials contained in the MeshMaterialMaps |
| GlobalShaderMap | Byte array that contains the serialized global shadermap from across the network. |
| bool RecompileChangedShadersForPlatform | ( | const FString & | PlatformName | ) |
Recompiles global shaders and material shaders rebuilds global shaders and also clears the cooked platform data for all materials if there is a global shader change detected can be slow
| void RecompileGlobalShaders | ( | ) |
Forces a recompile of the global shaders.
| bool RecompileShaders | ( | const TCHAR * | Cmd, |
| FOutputDevice & | Ar | ||
| ) |
Implementation of the 'recompileshaders' console command. Recompiles shaders at runtime based on various criteria.
| void ReloadGlobalShaders | ( | ) |
| FString SaveGlobalShaderFile | ( | EShaderPlatform | Platform, |
| FString | SavePath, | ||
| class ITargetPlatform * | TargetPlatform | ||
| ) |
Saves the global shader map as a file for the target platform.
| bool ShouldDumpShaderDDCKeys | ( | ) |
| void ShutdownGlobalShaderMap | ( | ) |
| void VerifyGlobalShaders | ( | EShaderPlatform | Platform, |
| bool | bLoadedFromCacheFile, | ||
| const TArray< const FShaderType * > * | OutdatedShaderTypes = nullptr, |
||
| const TArray< const FShaderPipelineType * > * | OutdatedShaderPipelineTypes = nullptr |
||
| ) |
Makes sure all global shaders are loaded and/or compiled for the passed in platform. Note: if compilation is needed, this only kicks off the compile.
| Platform | Platform to verify global shaders for |
| bLoadedFromCacheFile | Load the shaders from cache, will error out and not compile shaders if missing |
| OutdatedShaderTypes | Optional list of shader types, will trigger compilation job for shader types found in this list even if the map already has the shader. |
| OutdatedShaderPipelineTypes | Optional list of shader pipeline types, will trigger compilation job for shader pipeline types found in this list even if the map already has the pipeline. |
| void VerifyGlobalShaders | ( | EShaderPlatform | Platform, |
| const ITargetPlatform * | TargetPlatform, | ||
| bool | bLoadedFromCacheFile, | ||
| const TArray< const FShaderType * > * | OutdatedShaderTypes, | ||
| const TArray< const FShaderPipelineType * > * | OutdatedShaderPipelineTypes, | ||
| const FShaderCompilerFlags & | InExtraCompilerFlags | ||
| ) |
Makes sure all global shaders are loaded and/or compiled for the passed in platform. Note: if compilation is needed, this only kicks off the compile.
| Platform | Platform to verify global shaders for |
| int32 GCreateShadersOnLoad = 0 |
| FGlobalShaderMap* GGlobalShaderMap_DeferredDeleteCopy[SP_NumPlatforms] = {nullptr} |
Storage for the global shadar map(s) that have been replaced by new one(s), which aren't yet compiled.
Sometimes a mesh drawing command references a pointer to global SM's memory. To nix these MDCs when we're replacing a global SM, we would just recreate the render state for all the components, but we may need to access a global shader during such an update, creating a catch 22. So deleting the global SM and updating components is deferred until the new one is compiled.
| const ITargetPlatform* GGlobalShaderTargetPlatform[SP_NumPlatforms] = { nullptr } |
| int32 GMaxNumDumpedShaderSources = 10 |
| int32 GShaderCompilerAllowDistributedCompilation = 1 |
| FShaderCompilingManager* GShaderCompilingManager = nullptr |
The global shader compiling thread manager.
| int32 GSShaderCheckLevel = 1 |