FShaderCodeLibrary

Collection of unique shader code Populated at cook time

Windows
MacOS
Linux

References

Module

RenderCore

Header

/Engine/Source/Runtime/RenderCore/Public/ShaderCodeLibrary.h

Include

#include "ShaderCodeLibrary.h"

Syntax

struct FShaderCodeLibrary

Remarks

Collection of unique shader code Populated at cook time

Functions

Name Description

Public function Static

bool

 

AddShaderCode

(
    EShaderPlatform ShaderPlatform,
    const FShaderMapResourceCode* ...
)

At cook time, add shader code to collection.

Public function Static

void

 

AddShaderStableKeyValue

(
    EShaderPlatform ShaderPlatform,
    FStableShaderKeyAndValue& StableKe...
)

At cook time, add the human readable key value information.

Public function Static

void

 

CleanDirectories

(
    TArray< FName > const& ShaderForma...
)

Clean the cook directories.

Public function Static

void

 

CloseLibrary

(
    FString const& Name
)

Close a named library.

Public function Static

bool

 

ContainsShaderCode

(
    const FSHAHash& Hash
)

Public function Static

void

 

CookShaderFormats

(
    TArray< TTuple< FName, bool >> cons...
)

Specify the shader formats to cook and which ones needs stable keys.

Public function Static

FComputeShad...

 

CreateComputeShader

(
    EShaderPlatform Platform,
    const FSHAHash& Hash
)

Public function Static

FDomainShade...

 

CreateDomainShader

(
    EShaderPlatform Platform,
    const FSHAHash& Hash
)

Public function Static

FGeometrySha...

 

CreateGeometryShader

(
    EShaderPlatform Platform,
    const FSHAHash& Hash
)

Public function Static

FHullShaderR...

 

CreateHullShader

(
    EShaderPlatform Platform,
    const FSHAHash& Hash
)

Public function Static

bool

 

CreatePatchLibrary

(
    TArray< FString > const& OldMetaDa...,
    FString const& NewMetaDataDir,
    FString const& OutDir,
    bool bNativeFormat
)

Create a smaller 'patch' library that only contains data from 'NewMetaDataDir' not contained in any of 'OldMetaDataDirs'.

Public function Static

FPixelShader...

 

CreatePixelShader

(
    EShaderPlatform Platform,
    const FSHAHash& Hash
)

Public function Static

FVertexShade...

 

CreateVertexShader

(
    EShaderPlatform Platform,
    const FSHAHash& Hash
)

Public function Static

void

 

DumpShaderCodeStats()

Dump collected stats for each shader platform.

Public function Static

EShaderPlatf...

 

GetRuntimeShaderPlatform()

The shader platform that the library manages - at runtime this will only be one.

Public function Static

uint32

 

GetShaderCount()

Total number of shader entries in the library.

Public function Static

void

 

InitForCooking

(
    bool bNativeFormat
)

Initialize the library cooker.

Public function Static

void

 

InitForRuntime

(
    EShaderPlatform ShaderPlatform
)

Public function Static

bool

 

IsEnabled()

Public function Static

TRefCountPtr...

 

LoadResource

(
    const FSHAHash& Hash,
    FArchive* Ar
)

Public function Static

bool

 

NeedsShaderStableKeys

(
    EShaderPlatform ShaderPlatform
)

We check this early in the callstack to avoid creating a bunch of FName and keys and things we will never save anyway.

Public function Static

bool

 

OpenLibrary

(
    FString const& Name,
    FString const& Directory
)

Open a named library.

Public function Static

bool

 

PackageNativeShaderLibrary

(
    const FString& ShaderCodeDir,
    const TArray< FName >& ShaderForma...
)

Package the separate shader bytecode files into a single native shader library. Must be called by the master process.

Public function Static

bool

 

PreloadShader

(
    const FSHAHash& Hash,
    FArchive* Ar
)

Public function Static

FDelegateHan...

 

RegisterSharedShaderCodeRequestDelegate_Handle

(
    const FSharedShaderCodeRequest::FDe...
)

Delegate called whenever shader code is requested.

Public function Static

void

 

SafeAssignHash

(
    FRHIShader* InShader,
    const FSHAHash& Hash
)

Safely assign the hash to a shader object.

Public function Static

bool

 

SaveShaderCodeChild

(
    const FString& OutputDir,
    const FString& MetaOutputDir,
    const TArray< FName >& ShaderForma...
)

Save collected shader code to a file for each specified shader platform, handles only this instances intermediate results.

Public function Static

bool

 

SaveShaderCodeMaster

(
    const FString& OutputDir,
    const FString& MetaOutputDir,
    const TArray< FName >& ShaderForma...,
    TArray< FString >& OutSCLCSVPath
)

Save collected shader code to a file for each specified shader platform, collating all child cooker results.

Public function Static

void

 

Shutdown()

Public function Static

void

 

UnregisterSharedShaderCodeRequestDelegate_Handle

(
    FDelegateHandle Handle
)

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss