FShaderType

An object which is used to serialize/deserialize, compile, and cache a particular shader class.

Choose your operating system:

Windows

macOS

Linux

Inheritance Hierarchy

References

Module

RenderCore

Header

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

Include

#include "Shader.h"

Syntax

class FShaderType

Remarks

An object which is used to serialize/deserialize, compile, and cache a particular shader class.

A shader type can manage multiple instance of FShader across mutiple dimensions such as EShaderPlatform, or permutation id. The number of permutation of a shader type is simply given by GetPermutationCount().

Variables

Name Description

Protected variable

std::atomic< ES...

 

CachedUniformBufferPlatform

Tracks what platforms ReferencedUniformBufferStructsCache has had declarations cached for.

Protected variable

TMap< const TCH...

 

ReferencedUniformBufferStructsCache

Cache of referenced uniform buffer includes.

Constructors

Name Description

Public function

FShaderType

(
    EShaderTypeForDynamicCast InShaderT...,
    FTypeLayoutDesc& InTypeLayout,
    const TCHAR* InName,
    const TCHAR* InSourceFilename,
    const TCHAR* InFunctionName,
    uint32 InFrequency,
    int32 TotalPermutationCount,
    ConstructSerializedType InConstruct...,
    ConstructCompiledType InConstructCo...,
    ModifyCompilationEnvironmentType In...,
    ShouldCompilePermutationType InShou...,
    ValidateCompiledResultType InValida...,
    uint32 InTypeSize,
    const FShaderParametersMetadata...
)

Minimal initialization constructor.

Destructors

Name Description

Public function Virtual

~FShaderType()

Functions

Name Description

Public function Const

void

 

AddReferencedUniformBufferIncludes

(
    FShaderCompilerEnvironment& OutEnv...,
    FString& OutSourceFilePrefix,
    EShaderPlatform Platform
)

Adds include statements for uniform buffers that this shader type references, and builds a prefix for the shader file with the include statements.

Public function Const

const FGloba...

 

AsGlobalShaderType()

Public function Const

const FMater...

 

AsMaterialShaderType()

Public function Const

const FMeshM...

 

AsMeshMaterialShaderType()

Public function Const

const FNiaga...

 

AsNiagaraShaderType()

Public function Const

const FOpenC...

 

AsOpenColorIOShaderType()

Public function Const

FShader *...

 

ConstructCompiled

(
    const FShader::CompiledShaderInitia...
)

Public function Const

FShader *...

 

ConstructForDeserialization()

Constructs a new instance of the shader type for deserialization.

Public function

void

 

DumpDebugInfo()

Public function

void

 

FlushShaderFileCache

(
    const TMap< FString, TArray< const ...
)

Public function

FComputeKern...

 

GetComputeKernelShaderType()

Public function Const

const FCompu...

 

GetComputeKernelShaderType()

Public function Const

const FName ...

 

GetFName()

Public function Const

EShaderFrequ...

 

GetFrequency()

Public function Const

const TCHAR ...

 

GetFunctionName()

Public function

FGlobalShade...

 

GetGlobalShaderType()

Dynamic casts.

Public function Const

const FGloba...

 

GetGlobalShaderType()

Public function Const

const FHashe...

 

GetHashedName()

Public function Const

const FHashe...

 

GetHashedShaderFilename()

Public function Const

const FTypeL...

 

GetLayout()

Accessors.

Public function Const

const FMater...

 

GetMaterialShaderType()

Public function

FMaterialSha...

 

GetMaterialShaderType()

Public function Const

const FMeshM...

 

GetMeshMaterialShaderType()

Public function

FMeshMateria...

 

GetMeshMaterialShaderType()

Public function Const

const TCHAR ...

 

GetName()

Public function Static

TMap< FHashe...

 

GetNameToTypeMap()

Public function

FNiagaraShad...

 

GetNiagaraShaderType()

Public function Const

const FNiaga...

 

GetNiagaraShaderType()

Public function Const

int32

 

GetNumShaders()

Public function

FOpenColorIO...

 

GetOpenColorIOShaderType()

Public function Const

const FOpenC...

 

GetOpenColorIOShaderType()

Public function Const

int32

 

GetPermutationCount()

Public function Const

const TMap< ...

 

GetReferencedUniformBufferStructsCache()

Public function Const

const FShade...

 

GetRootParametersMetadata()

Returns the meta data for the root shader parameter struct.

Public function Const

const TCHAR ...

 

GetShaderFilename()

Public function

void

 

GetShaderStableKeyParts

(
    FStableShaderKeyAndValue& SaveKeyV...
)

Public function Static

FShaderType ...

 

GetShaderTypeByName

(
    const TCHAR* Name
)

Public function Static

TArray< cons...

 

GetShaderTypesByFilename

(
    const TCHAR* Filename
)

Public function Static

const TArray...

 

GetSortedTypes

(
    EShaderTypeForDynamicCast Type
)

Public function Const

const FSHAHa...

 

GetSourceHash

(
    EShaderPlatform ShaderPlatform
)

Calculates a Hash based on this shader type's source code and includes

Public function Const

EShaderTypeF...

 

GetTypeForDynamicCast()

Public function Static

TLinkedList<...

 

GetTypeList()

Public function Const

uint32

 

GetTypeSize()

Public function Static

void

 

Initialize

(
    const TMap< FString, TArray< const ...
)

Initialize FShaderType static members, this must be called before any shader types are created.

Public function Const

void

 

ModifyCompilationEnvironment

(
    const FShaderPermutationParameters ...,
    FShaderCompilerEnvironment& OutEnv...
)

Public function Const

bool

 

ShouldCompilePermutation

(
    const FShaderPermutationParameters ...
)

Public function Static

void

 

Uninitialize()

Uninitializes FShaderType cached data.

Public function Const

bool

 

ValidateCompiledResult

(
    EShaderPlatform Platform,
    const FShaderParameterMap& Paramet...,
    TArray< FString >& OutError
)

Checks if the shader type should pass compilation for a particular set of parameters.

Classes

Name

Description

Public class

FParameters

Derived FShaderTypes should derive from this class to pass params to FShader constructor

Enums

Name

Description

Public enum

EShaderTypeForDynamicCast

Typedefs

Constants

Name

Description

bInitializedSerializationHistory

Tracks whether serialization history for all shader types has been initialized.