UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
TShaderPermutationDomain< Ts > Struct Template Reference

#include <ShaderPermutation.h>

Public Types

using Type = TShaderPermutationDomain< Ts... >
 

Public Member Functions

 TShaderPermutationDomain ()
 
 TShaderPermutationDomain (int32 PermutationId)
 
template<class DimensionToSet >
void Set (typename DimensionToSet::Type)
 
template<class DimensionToGet >
const DimensionToGet::Type Get () const
 
void ModifyCompilationEnvironment (FShaderCompilerEnvironment &OutEnvironment) const
 
int32 ToDimensionValueId () const
 
bool operator== (const Type &Other) const
 

Static Public Member Functions

static int32 ToDimensionValueId (const Type &PermutationVector)
 
static Type FromDimensionValueId (const int32 PermutationId)
 

Static Public Attributes

static constexpr bool IsMultiDimensional = true
 
static constexpr int32 PermutationCount = 1
 

Detailed Description

template<typename... Ts>
struct TShaderPermutationDomain< Ts >

Variadic template that defines an arbitrary multi-dimensional permutation domain, that can be instantiated to represent a vector within the domain.

// Defines a permutation domain with arbitrary number of dimensions. Dimensions can themselves be domains. // It is totally legal to have a domain with no dimensions. class FMyPermutationDomain = TShaderPermutationDomain<FMyDimensionA, FMyDimensionB, FMyDimensionC>;

// ...

// Create a permutation vector to be initialized. By default a vector is set at the origin of the domain. // The origin of the domain is the ShaderPermutationId == 0. FMyPermutationDomain PermutationVector;

// Set the permutation vector's dimensions. PermutationVector.Set<FMyDimensionA>(MyDimensionValueA); PermutationVector.Set<FMyDimensionB>(MyDimensionValueB); PermutationVector.Set<FMyDimensionC>(MyDimensionValueC);

// Get the permutation id from the permutation vector for shader compiler. int32 ShaderPermutationId = PermutationVector.ToDimensionValueId();

// Reconstruct the permutation vector from shader permutation id. FMyPermutationDomain PermutationVector2(ShaderPermutationId);

// Get permutation vector's dimension. if (PermutationVector2.Get<FMyDimensionA>()) { }

Member Typedef Documentation

◆ Type

template<typename... Ts>
using TShaderPermutationDomain< Ts >::Type = TShaderPermutationDomain<Ts...>

Setup the dimension's type in permutation domain as itself so that a permutation domain can be used as a dimension of another domain.

Constructor & Destructor Documentation

◆ TShaderPermutationDomain() [1/2]

template<typename... Ts>
TShaderPermutationDomain< Ts >::TShaderPermutationDomain ( )
inline

Constructors.

◆ TShaderPermutationDomain() [2/2]

template<typename... Ts>
TShaderPermutationDomain< Ts >::TShaderPermutationDomain ( int32  PermutationId)
inlineexplicit

Member Function Documentation

◆ FromDimensionValueId()

template<typename... Ts>
static Type TShaderPermutationDomain< Ts >::FromDimensionValueId ( const int32  PermutationId)
inlinestatic

Returns the permutation domain from the unique ID.

◆ Get()

template<typename... Ts>
template<class DimensionToGet >
const DimensionToGet::Type TShaderPermutationDomain< Ts >::Get ( ) const
inline

get dimension's value, but in this case emit compile time error if could not find the dimension to get.

◆ ModifyCompilationEnvironment()

template<typename... Ts>
void TShaderPermutationDomain< Ts >::ModifyCompilationEnvironment ( FShaderCompilerEnvironment OutEnvironment) const
inline

Modify compilation environment.

◆ operator==()

template<typename... Ts>
bool TShaderPermutationDomain< Ts >::operator== ( const Type Other) const
inline

Test if equal.

◆ Set()

template<typename... Ts>
template<class DimensionToSet >
void TShaderPermutationDomain< Ts >::Set ( typename DimensionToSet::Type  )
inline

Set dimension's value, but in this case emit compile time error if could not find the dimension to set.

◆ ToDimensionValueId() [1/2]

template<typename... Ts>
int32 TShaderPermutationDomain< Ts >::ToDimensionValueId ( ) const
inline

◆ ToDimensionValueId() [2/2]

template<typename... Ts>
static int32 TShaderPermutationDomain< Ts >::ToDimensionValueId ( const Type PermutationVector)
inlinestatic

Converts domain permutation vector to domain's value id.

Member Data Documentation

◆ IsMultiDimensional

template<typename... Ts>
constexpr bool TShaderPermutationDomain< Ts >::IsMultiDimensional = true
staticconstexpr

Define a domain as a multidimensional dimension so that ModifyCompilationEnvironment() is getting used.

◆ PermutationCount

template<typename... Ts>
constexpr int32 TShaderPermutationDomain< Ts >::PermutationCount = 1
staticconstexpr

Total number of permutation within the domain is one if no dimension at all.


The documentation for this struct was generated from the following file: