FShaderType

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

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

bool

 

bCachedUniformBufferStructDeclarations

Tracks what platforms ReferencedUniformBufferStructsCache has had declarations cached for.

Protected variable

TMap< const TCHAR *, FCachedUniformBufferDeclaration >

 

ReferencedUniformBufferStructsCache

Cache of referenced uniform buffer includes.

Constructors

Name Description

Public function

FShaderType

(
    EShaderTypeForDynamicCast InShaderTypeForDynamicCast,
    const TCHAR* InName,
    const TCHAR* InSourceFilename,
    const TCHAR* InFunctionName,
    uint32 InFrequency,
    int32 TotalPermutationCount,
    ConstructSerializedType InConstructSerializedRef,
    const FShaderParametersMetadata* InRootParametersMetadata
)

Minimal initialization constructor.

Destructors

Name Description

Public function Virtual

~FShaderType()

Functions

Name Description

Public function

void

 

AddReferencedUniformBufferIncludes

(
    FShaderCompilerEnvironment& OutEnvironment,
    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

void

 

AddToShaderMap

(
    const FShaderKey& Key,
    FShader* Shader
)

Public function Const

FShader *

 

ConstructForDeserialization()

Constructs a new instance of the shader type for deserialization.

Public function

void

 

DumpDebugInfo()

Public function

FShader *

 

FindShaderByKey

(
    const FShaderKey& Key
)

Finds a shader of this type by Key.

Public function

void

 

FlushShaderFileCache

(
    const TMap< FString, TArray< const TCHAR* > >& ShaderFileToUniformBufferVariables
)

Public function Const

const FName &

 

GetFName()

Public function Const

EShaderFrequency

 

GetFrequency()

Accessors.

Public function Const

const TCHAR *

 

GetFunctionName()

Public function Const

const FGlobalShaderType *

 

GetGlobalShaderType()

Public function

FGlobalShaderType *

 

GetGlobalShaderType()

Dynamic casts.

Public function Const

const FMaterialShaderType *

 

GetMaterialShaderType()

Public function

FMaterialShaderType *

 

GetMaterialShaderType()

Public function Const

const FMeshMaterialShaderType *

 

GetMeshMaterialShaderType()

Public function

FMeshMaterialShaderType *

 

GetMeshMaterialShaderType()

Public function Const

const TCHAR *

 

GetName()

Public function Static

TMap< FName, FShaderType * > &

 

GetNameToTypeMap()

Public function

FNiagaraShaderType *

 

GetNiagaraShaderType()

Public function Const

const FNiagaraShaderType *

 

GetNiagaraShaderType()

Public function Const

int32

 

GetNumShaders()

Public function

FOpenColorIOShaderType *

 

GetOpenColorIOShaderType()

Public function Const

const FOpenColorIOShaderType *

 

GetOpenColorIOShaderType()

Public function Const

bool

 

GetOutdatedCurrentType

(
    TArray< FShaderType* >& OutdatedShaderTypes,
    TArray< const FVertexFactoryType* >& OutdatedFactoryTypes
)

Returns true if the source file no longer matches what that type was compiled with

Public function Static

void

 

GetOutdatedTypes

(
    TArray< FShaderType* >& OutdatedShaderTypes,
    TArray< const FVertexFactoryType* >& OutdatedFactoryTypes
)

Gets a list of FShaderTypes whose source file no longer matches what that type was compiled with

Public function Const

int32

 

GetPermutationCount()

Public function Const

const TMap< const TCHAR *, FCachedUniformBufferDeclaration > &

 

GetReferencedUniformBufferStructsCache()

Public function Const

const FShaderParametersMetadata *

 

GetRootParametersMetadata()

Returns the meta data for the root shader parameter struct.

Public function Const

const FSerializationHistory &

 

GetSerializationHistory()

Public function Const

const TCHAR *

 

GetShaderFilename()

Public function

void

 

GetShaderStableKeyParts

(
    FStableShaderKeyAndValue& SaveKeyVal
)

Public function Static

FShaderType *

 

GetShaderTypeByName

(
    const TCHAR* Name
)

Public function Static

TArray< FShaderType * >

 

GetShaderTypesByFilename

(
    const TCHAR* Filename
)

Public function Const

const FSHAHash &

 

GetSourceHash

(
    EShaderPlatform ShaderPlatform
)

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

Public function Static

TLinkedList< FShaderType * > *&

 

GetTypeList()

Public function Static

void

 

Initialize

(
    const TMap< FString, TArray< const TCHAR* > >& ShaderFileToUniformBufferVariables
)

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

Public function

void

 

RemoveFromShaderMap

(
    const FShaderKey& Key
)

Public function

void

 

SaveShaderStableKeys

(
    EShaderPlatform TargetShaderPlatform
)

Public function Static

void

 

Uninitialize()

Uninitializes FShaderType cached data.

Enums

Name

Description

Public enum

EShaderTypeForDynamicCast

Typedefs

Name

Description

ConstructSerializedType

Constants

Name

Description

bInitializedSerializationHistory

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

Select Skin
Light
Dark

Welcome to the new Unreal Engine 4 Documentation site!

We're working on lots of new features including a feedback system so you can tell us how we are doing. It's not quite ready for use in the wild yet, so head over to the Documentation Feedback forum to tell us about this page or call out any issues you are encountering in the meantime.

We'll be sure to let you know when the new system is up and running.

Post Feedback