UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
ShaderCodeLibrary.cpp File Reference

Classes

struct  UE::ShaderLibrary::Private::FMountedPakFileInfo
 
struct  UE::ShaderLibrary::Private::FNamedShaderLibrary
 
class  FShaderMapResource_SharedCode
 
class  FShaderLibraryInstance
 
class  FShaderLibrariesCollection
 

Namespaces

namespace  UE
 
namespace  UE::ShaderLibrary
 
namespace  UE::ShaderLibrary::Private
 

Macros

#define UE_SHADERLIB_WITH_INTROSPECTION   !UE_BUILD_SHIPPING
 
#define UE_SHADERLIB_SUPPORT_CHUNK_DISCOVERY   (1)
 

Functions

 DEFINE_LOG_CATEGORY (LogShaderLibrary)
 
FString UE::ShaderLibrary::Private::GetShaderLibraryNameForChunk (FString const &BaseName, int32 ChunkId)
 
bool UE::ShaderLibrary::Private::IsRunningWithPakFile ()
 
bool UE::ShaderLibrary::Private::IsRunningWithIoStore ()
 
bool UE::ShaderLibrary::Private::IsRunningWithZenStore ()
 
bool UE::ShaderLibrary::Private::ShouldLookForLooseCookedChunks ()
 
FORCEINLINE FName ParseFNameCached (const FStringView &Src, TMap< uint32, FName > &NameCache)
 
uint32 GetTypeHash (const FCompactFullName &A)
 
void FixupUnsanitizedNames (const FString &Src, TArray< FString > &OutFields)
 
void DiagnoseLeakingShaderMapResourceRefs (const FShaderMapResource_SharedCode *InResource)
 

Variables

int32 GShaderCodeLibrarySeparateLoadingCache = 0
 
int32 GPreloadShaderMaps = 1
 
bool GShaderMapResourceRef = false
 
bool GUploadShaderDebugArtifacts = false
 
int32 UE::ShaderLibrary::Private::GProduceExtendedStats = 1
 
FSharedShaderMapResourceExplicitRelease OnSharedShaderMapResourceExplicitRelease
 
FAutoConsoleCommandWithArgsAndOutputDevice GListShaderLibrariesCmd (TEXT("ListShaderLibraries"), TEXT("Spits out a csv table containing stats of all shader libraries"), FConsoleCommandWithArgsAndOutputDeviceDelegate::CreateStatic([](const TArray< FString > &Params, FOutputDevice &Out) { auto Iter=[&](const FString &LogicalName, UE::ShaderLibrary::Private::FNamedShaderLibrary &NamedShaderLibrary) { FRWScopeLock ComponentReadLock(NamedShaderLibrary.ComponentsMutex, SLT_ReadOnly);for(const TUniquePtr< FShaderLibraryInstance > &ShaderLibrary :NamedShaderLibrary.Components) { const FString &Name=ShaderLibrary->Library->GetName();const FString OwnerName=ShaderLibrary->Library->GetOwnerName().ToString();uint32 Id=ShaderLibrary->Library->GetId();int32 NumShaders=ShaderLibrary->GetNumShaders();int32 NumShaderMaps=ShaderLibrary->GetNumResources();uint32 LibrarySize=ShaderLibrary->GetSizeBytes();uint32 RHILibrarySize=ShaderLibrary->Library->GetSizeBytes();uint32 MapsSize=ShaderLibrary->GetShaderMapsSizeBytes();Out.Logf(TEXT("%s,%s,%s,%x,%d,%d,%.3f,%.3f,%.3f"), *Name, *LogicalName, *OwnerName, Id, NumShaders, NumShaderMaps, LibrarySize/1024.f, RHILibrarySize/1024.f, MapsSize/1024.f);} };if(FShaderLibrariesCollection *Collection=FShaderLibrariesCollection::Impl) { Out.Logf(TEXT("ShaderLibraryName,LogicalName,OwnerName,Id,NumShaders,NumShaderMaps,LibrarySizeKb,RHILibrarySizeKb,ShaderMapsSizeKb"));Collection->IterateNamedShaderLibrariesSafe(Iter);} else { UE_LOG(LogShaderLibrary, Warning, TEXT("ShaderLibrariesCollection is not available."));} }))
 

Macro Definition Documentation

◆ UE_SHADERLIB_SUPPORT_CHUNK_DISCOVERY

#define UE_SHADERLIB_SUPPORT_CHUNK_DISCOVERY   (1)

◆ UE_SHADERLIB_WITH_INTROSPECTION

#define UE_SHADERLIB_WITH_INTROSPECTION   !UE_BUILD_SHIPPING

Function Documentation

◆ DEFINE_LOG_CATEGORY()

DEFINE_LOG_CATEGORY ( LogShaderLibrary  )

◆ DiagnoseLeakingShaderMapResourceRefs()

void DiagnoseLeakingShaderMapResourceRefs ( const FShaderMapResource_SharedCode InResource)

◆ FixupUnsanitizedNames()

void FixupUnsanitizedNames ( const FString &  Src,
TArray< FString > &  OutFields 
)

◆ GetTypeHash()

uint32 GetTypeHash ( const FCompactFullName A)

◆ ParseFNameCached()

FORCEINLINE FName ParseFNameCached ( const FStringView Src,
TMap< uint32, FName > &  NameCache 
)

Variable Documentation

◆ GListShaderLibrariesCmd

FAutoConsoleCommandWithArgsAndOutputDevice GListShaderLibrariesCmd(TEXT("ListShaderLibraries"), TEXT("Spits out a csv table containing stats of all shader libraries"), FConsoleCommandWithArgsAndOutputDeviceDelegate::CreateStatic([](const TArray< FString > &Params, FOutputDevice &Out) { auto Iter=[&](const FString &LogicalName, UE::ShaderLibrary::Private::FNamedShaderLibrary &NamedShaderLibrary) { FRWScopeLock ComponentReadLock(NamedShaderLibrary.ComponentsMutex, SLT_ReadOnly); for(const TUniquePtr< FShaderLibraryInstance > &ShaderLibrary :NamedShaderLibrary.Components) { const FString &Name=ShaderLibrary->Library->GetName(); const FString OwnerName=ShaderLibrary->Library->GetOwnerName().ToString(); uint32 Id=ShaderLibrary->Library->GetId(); int32 NumShaders=ShaderLibrary->GetNumShaders(); int32 NumShaderMaps=ShaderLibrary->GetNumResources(); uint32 LibrarySize=ShaderLibrary->GetSizeBytes(); uint32 RHILibrarySize=ShaderLibrary->Library->GetSizeBytes(); uint32 MapsSize=ShaderLibrary->GetShaderMapsSizeBytes(); Out.Logf(TEXT("%s,%s,%s,%x,%d,%d,%.3f,%.3f,%.3f"), *Name, *LogicalName, *OwnerName, Id, NumShaders, NumShaderMaps, LibrarySize/1024.f, RHILibrarySize/1024.f, MapsSize/1024.f); } }; if(FShaderLibrariesCollection *Collection=FShaderLibrariesCollection::Impl) { Out.Logf(TEXT("ShaderLibraryName,LogicalName,OwnerName,Id,NumShaders,NumShaderMaps,LibrarySizeKb,RHILibrarySizeKb,ShaderMapsSizeKb")); Collection->IterateNamedShaderLibrariesSafe(Iter); } else { UE_LOG(LogShaderLibrary, Warning, TEXT("ShaderLibrariesCollection is not available.")); } })) ( TEXT("ListShaderLibraries")  ,
TEXT("Spits out a csv table containing stats of all shader libraries" ,
FConsoleCommandWithArgsAndOutputDeviceDelegate::CreateStatic([](const TArray< FString > &Params, FOutputDevice &Out) { auto Iter=[&](const FString &LogicalName, UE::ShaderLibrary::Private::FNamedShaderLibrary &NamedShaderLibrary) { FRWScopeLock ComponentReadLock(NamedShaderLibrary.ComponentsMutex, SLT_ReadOnly); for(const TUniquePtr< FShaderLibraryInstance > &ShaderLibrary :NamedShaderLibrary.Components) { const FString &Name=ShaderLibrary->Library->GetName(); const FString OwnerName=ShaderLibrary->Library->GetOwnerName().ToString(); uint32 Id=ShaderLibrary->Library->GetId(); int32 NumShaders=ShaderLibrary->GetNumShaders(); int32 NumShaderMaps=ShaderLibrary->GetNumResources(); uint32 LibrarySize=ShaderLibrary->GetSizeBytes(); uint32 RHILibrarySize=ShaderLibrary->Library->GetSizeBytes(); uint32 MapsSize=ShaderLibrary->GetShaderMapsSizeBytes(); Out.Logf(TEXT("%s,%s,%s,%x,%d,%d,%.3f,%.3f,%.3f"), *Name, *LogicalName, *OwnerName, Id, NumShaders, NumShaderMaps, LibrarySize/1024.f, RHILibrarySize/1024.f, MapsSize/1024.f); } }; if(FShaderLibrariesCollection *Collection=FShaderLibrariesCollection::Impl) { Out.Logf(TEXT("ShaderLibraryName,LogicalName,OwnerName,Id,NumShaders,NumShaderMaps,LibrarySizeKb,RHILibrarySizeKb,ShaderMapsSizeKb")); Collection->IterateNamedShaderLibrariesSafe(Iter); } else { UE_LOG(LogShaderLibrary, Warning, TEXT("ShaderLibrariesCollection is not available.")); } })   
)

◆ GPreloadShaderMaps

int32 GPreloadShaderMaps = 1

◆ GShaderCodeLibrarySeparateLoadingCache

int32 GShaderCodeLibrarySeparateLoadingCache = 0

◆ GShaderMapResourceRef

bool GShaderMapResourceRef = false

◆ GUploadShaderDebugArtifacts

bool GUploadShaderDebugArtifacts = false

◆ OnSharedShaderMapResourceExplicitRelease

FSharedShaderMapResourceExplicitRelease OnSharedShaderMapResourceExplicitRelease