UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
FShader Class Reference

#include <Shader.h>

+ Inheritance diagram for FShader:

Public Types

using FPermutationDomain = FShaderPermutationNone
 
using FPermutationParameters = FShaderPermutationParameters
 
using CompiledShaderInitializerType = FShaderCompiledShaderInitializerType
 
using ShaderMetaType = FShaderType
 
using ShaderStatKeyType = FMemoryImageName
 
using FShaderStatisticMap = TMemoryImageMap< ShaderStatKeyType, FShaderStatVariant >
 

Public Member Functions

RENDERCORE_API FShader ()
 
RENDERCORE_API FShader (const CompiledShaderInitializerType &Initializer)
 
RENDERCORE_API ~FShader ()
 
RENDERCORE_API const FSHAHashGetHash () const
 
RENDERCORE_API const FSHAHashGetVertexFactoryHash () const
 
RENDERCORE_API const FSHAHashGetOutputHash () const
 
uint32 GetSortKey () const
 
RENDERCORE_API void Finalize (const FShaderMapResourceCode *Code)
 
FShaderTypeGetType (const FShaderMapPointerTable &InPointerTable) const
 
FShaderTypeGetType (const FPointerTableBase *InPointerTable) const
 
FVertexFactoryTypeGetVertexFactoryType (const FShaderMapPointerTable &InPointerTable) const
 
FVertexFactoryTypeGetVertexFactoryType (const FPointerTableBase *InPointerTable) const
 
FShaderTypeGetTypeUnfrozen () const
 
int32 GetResourceIndex () const
 
EShaderPlatform GetShaderPlatform () const
 
EShaderFrequency GetFrequency () const
 
const FShaderTarget GetTarget () const
 
bool IsFrozen () const
 
uint32 GetNumInstructions () const
 
uint32 GetNumTextureSamplers () const
 
uint32 GetCodeSize () const
 
void SetNumInstructions (uint32 Value)
 
template<typename UniformBufferStructType >
const TShaderUniformBufferParameter< UniformBufferStructType > & GetUniformBufferParameter () const
 
const FShaderUniformBufferParameterGetUniformBufferParameter (const FShaderParametersMetadata *SearchStruct) const
 
const FShaderUniformBufferParameterGetUniformBufferParameter (const FHashedName SearchName) const
 
RENDERCORE_API const FShaderParametersMetadataFindAutomaticallyBoundUniformBufferStruct (int32 BaseIndex) const
 
RENDERCORE_API void DumpDebugInfo (const FShaderMapPointerTable &InPtrTable)
 
 LAYOUT_FIELD (FShaderParameterBindings, Bindings)
 
 LAYOUT_FIELD (FShaderParameterMapInfo, ParameterMapInfo)
 

Static Public Member Functions

static void ModifyCompilationEnvironment (const FShaderPermutationParameters &, FShaderCompilerEnvironment &)
 
static const FShaderBindingLayoutGetShaderBindingLayout (const FShaderPermutationParameters &)
 
static bool ShouldCompilePermutation (const FShaderPermutationParameters &)
 
static EShaderPermutationPrecacheRequest ShouldPrecachePermutation (const FShaderPermutationParameters &Parameters)
 
static bool ValidateCompiledResult (EShaderPlatform InPlatform, const FShaderParameterMap &InParameterMap, TArray< FString > &OutError)
 
static EShaderCompileJobPriority GetOverrideJobPriority ()
 
static ERayTracingPayloadType GetRayTracingPayloadType (const int32 PermutationId)
 
static const FShaderParametersMetadataGetRootParametersMetadata ()
 

Protected Member Functions

 LAYOUT_FIELD (TMemoryImageArray< FHashedName >, UniformBufferParameterStructs)
 
 LAYOUT_FIELD (TMemoryImageArray< FShaderUniformBufferParameter >, UniformBufferParameters)
 
 LAYOUT_FIELD_EDITORONLY (FSHAHash, OutputHash)
 
 LAYOUT_FIELD_EDITORONLY (FSHAHash, VFSourceHash)
 
 LAYOUT_FIELD_EDITORONLY (FSHAHash, SourceHash)
 

Friends

class FShaderType
 

Detailed Description

A compiled shader and its parameter bindings.

Member Typedef Documentation

◆ CompiledShaderInitializerType

◆ FPermutationDomain

◆ FPermutationParameters

◆ FShaderStatisticMap

◆ ShaderMetaType

◆ ShaderStatKeyType

Constructor & Destructor Documentation

◆ FShader() [1/2]

FShader::FShader ( )

Used to construct a shader for deserialization. This still needs to initialize members to safe values since FShaderType::GenerateSerializationHistory uses this constructor.

◆ FShader() [2/2]

FShader::FShader ( const CompiledShaderInitializerType Initializer)

Construct a shader from shader compiler output.

◆ ~FShader()

FShader::~FShader ( )

Member Function Documentation

◆ DumpDebugInfo()

void FShader::DumpDebugInfo ( const FShaderMapPointerTable InPtrTable)

◆ Finalize()

void FShader::Finalize ( const FShaderMapResourceCode Code)

◆ FindAutomaticallyBoundUniformBufferStruct()

const FShaderParametersMetadata * FShader::FindAutomaticallyBoundUniformBufferStruct ( int32  BaseIndex) const

◆ GetCodeSize()

uint32 FShader::GetCodeSize ( ) const
inline

◆ GetFrequency()

EShaderFrequency FShader::GetFrequency ( ) const
inline

◆ GetHash()

const FSHAHash & FShader::GetHash ( ) const

Returns the hash of the shader file that this shader was compiled with.

◆ GetNumInstructions()

uint32 FShader::GetNumInstructions ( ) const
inline

◆ GetNumTextureSamplers()

uint32 FShader::GetNumTextureSamplers ( ) const
inline

◆ GetOutputHash()

const FSHAHash & FShader::GetOutputHash ( ) const

◆ GetOverrideJobPriority()

static EShaderCompileJobPriority FShader::GetOverrideJobPriority ( )
inlinestatic

Can be overridden by FShader subclasses to set a custom job priority (EShaderCompileJobPriority) or EShaderCompileJobPriority::None to ignore custom priority. This can only increase priority.

◆ GetRayTracingPayloadType()

static ERayTracingPayloadType FShader::GetRayTracingPayloadType ( const int32  PermutationId)
inlinestatic

Can be overriden by FShader subclasses to specify which raytracing payload should be used. This method is only called for raytracing shaders.

◆ GetResourceIndex()

int32 FShader::GetResourceIndex ( ) const
inline

◆ GetRootParametersMetadata()

static const FShaderParametersMetadata * FShader::GetRootParametersMetadata ( )
inlinestatic

Returns the meta data for the root shader parameter struct.

◆ GetShaderBindingLayout()

static const FShaderBindingLayout * FShader::GetShaderBindingLayout ( const FShaderPermutationParameters )
inlinestatic

Get shader binding layout used by the shader

◆ GetShaderPlatform()

EShaderPlatform FShader::GetShaderPlatform ( ) const
inline

◆ GetSortKey()

uint32 FShader::GetSortKey ( ) const
inline

Returns an identifier suitable for deterministic sorting of shaders between sessions.

◆ GetTarget()

const FShaderTarget FShader::GetTarget ( ) const
inline

◆ GetType() [1/2]

FShaderType * FShader::GetType ( const FPointerTableBase InPointerTable) const
inline

◆ GetType() [2/2]

FShaderType * FShader::GetType ( const FShaderMapPointerTable InPointerTable) const
inline

◆ GetTypeUnfrozen()

FShaderType * FShader::GetTypeUnfrozen ( ) const
inline

◆ GetUniformBufferParameter() [1/3]

const TShaderUniformBufferParameter< UniformBufferStructType > & FShader::GetUniformBufferParameter ( ) const
inline

Finds an automatically bound uniform buffer matching the given uniform buffer type if one exists, or returns an unbound parameter.

◆ GetUniformBufferParameter() [2/3]

const FShaderUniformBufferParameter & FShader::GetUniformBufferParameter ( const FHashedName  SearchName) const
inline

Finds an automatically bound uniform buffer matching the HashedName if one exists, or returns an unbound parameter.

◆ GetUniformBufferParameter() [3/3]

const FShaderUniformBufferParameter & FShader::GetUniformBufferParameter ( const FShaderParametersMetadata SearchStruct) const
inline

Finds an automatically bound uniform buffer matching the given uniform buffer struct if one exists, or returns an unbound parameter.

◆ GetVertexFactoryHash()

const FSHAHash & FShader::GetVertexFactoryHash ( ) const

◆ GetVertexFactoryType() [1/2]

FVertexFactoryType * FShader::GetVertexFactoryType ( const FPointerTableBase InPointerTable) const
inline

◆ GetVertexFactoryType() [2/2]

FVertexFactoryType * FShader::GetVertexFactoryType ( const FShaderMapPointerTable InPointerTable) const
inline

◆ IsFrozen()

bool FShader::IsFrozen ( ) const
inline

◆ LAYOUT_FIELD() [1/4]

FShader::LAYOUT_FIELD ( FShaderParameterBindings  ,
Bindings   
)

◆ LAYOUT_FIELD() [2/4]

FShader::LAYOUT_FIELD ( FShaderParameterMapInfo  ,
ParameterMapInfo   
)

◆ LAYOUT_FIELD() [3/4]

FShader::LAYOUT_FIELD ( TMemoryImageArray< FHashedName ,
UniformBufferParameterStructs   
)
protected

◆ LAYOUT_FIELD() [4/4]

FShader::LAYOUT_FIELD ( TMemoryImageArray< FShaderUniformBufferParameter ,
UniformBufferParameters   
)
protected

◆ LAYOUT_FIELD_EDITORONLY() [1/3]

FShader::LAYOUT_FIELD_EDITORONLY ( FSHAHash  ,
OutputHash   
)
protected

Hash of the compiled output from this shader and the resulting parameter map. This is used to find a matching resource.

◆ LAYOUT_FIELD_EDITORONLY() [2/3]

FShader::LAYOUT_FIELD_EDITORONLY ( FSHAHash  ,
SourceHash   
)
protected

Hash of this shader's source files generated at compile time, and stored to allow creating an FShaderId.

◆ LAYOUT_FIELD_EDITORONLY() [3/3]

FShader::LAYOUT_FIELD_EDITORONLY ( FSHAHash  ,
VFSourceHash   
)
protected

Vertex factory source hash, stored so that an FShaderId can be constructed from this shader.

◆ ModifyCompilationEnvironment()

static void FShader::ModifyCompilationEnvironment ( const FShaderPermutationParameters ,
FShaderCompilerEnvironment  
)
inlinestatic

Can be overridden by FShader subclasses to modify their compile environment just before compilation occurs.

◆ SetNumInstructions()

void FShader::SetNumInstructions ( uint32  Value)
inline

◆ ShouldCompilePermutation()

static bool FShader::ShouldCompilePermutation ( const FShaderPermutationParameters )
inlinestatic

Can be overridden by FShader subclasses to determine whether a specific permutation should be compiled.

◆ ShouldPrecachePermutation()

static EShaderPermutationPrecacheRequest FShader::ShouldPrecachePermutation ( const FShaderPermutationParameters Parameters)
inlinestatic

Can be overridden by FShader subclasses to determine whether a specific permutation should be precached.

◆ ValidateCompiledResult()

static bool FShader::ValidateCompiledResult ( EShaderPlatform  InPlatform,
const FShaderParameterMap InParameterMap,
TArray< FString > &  OutError 
)
inlinestatic

Can be overridden by FShader subclasses to determine whether compilation is valid.

Friends And Related Symbol Documentation

◆ FShaderType

friend class FShaderType
friend

The documentation for this class was generated from the following files: