Navigation
API > API/Runtime > API/Runtime/Engine
This class represents the intermediate representation (IR) of a material build. The IRModule includes an IR value graph, produced through expression analysis, as well as metadata on resource usage and reflection. The IR graph serves as an abstract representation of the material and must be translated into a target backend such as HLSL or specific Preshader opcodes for execution.
This class is designed to be backend-agnostic, meaning it does not contain any HLSL code nor does it configure a MaterialCompilationOutput instance. The data stored within this class should be sufficient to enable translation to any supported backend without requiring additional processing or validation.
| Name | FMaterialIRModule |
| Type | class |
| Header File | /Engine/Source/Runtime/Engine/Public/Materials/MaterialIRModule.h |
| Include Path | #include "Materials/MaterialIRModule.h" |
Syntax
class FMaterialIRModule
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
FMaterialIRModule() |
Materials/MaterialIRModule.h |
Destructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
~FMaterialIRModule() |
Materials/MaterialIRModule.h |
Structs
| Name | Remarks |
|---|---|
| FCustomOutputGroup | Models a group of custom outputs contained in the module. |
| FEntryPoint | An entry point is a sequence of instructions that evaluates a set of "output" instructions. |
| FError | Represents an error encountered during material processing. |
| FStatistics | Stores information about the resources used by the translated material. |
| FSubstrateData | Specific Substrate data that needs to be handled in a specific way today when emitting back shader code from IR. |
Variables
Protected
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| Allocator | FMemStackBase | The chunk allocator used to contain child allocations (e.g., values, interned strings, etc) | Materials/MaterialIRModule.h | |
| BlendMode | EBlendMode | Target blend mode separate from UMaterial, as it may potentially overridden in a UMaterialInstance. | Materials/MaterialIRModule.h | |
| CompilationOutput | FMaterialCompilationOutput | Compilation output data. | Materials/MaterialIRModule.h | |
| CustomOutputGroups | TArray< FCustomOutputGroup > | Array of custom output groups in this module. | Materials/MaterialIRModule.h | |
| CustomOutputs | TArray< const MIR::FSetMaterialOutput * > | Array of user-generated custom outputs in this module. | Materials/MaterialIRModule.h | |
| EntryPoints | TArray< FEntryPoint > | Array of entry points in this module. | Materials/MaterialIRModule.h | |
| EnvironmentDefines | TSet< FName > | Environment define names for shader compilation in this module. | Materials/MaterialIRModule.h | |
| Errors | TArray< FError > | List of compilation errors. | Materials/MaterialIRModule.h | |
| FeatureLevel | ERHIFeatureLevel::Type | Target feature level. | Materials/MaterialIRModule.h | |
| FMaterialIRModuleBuilder | friend | Materials/MaterialIRModule.h | ||
| FMaterialIRModuleBuilderImpl | friend | Materials/MaterialIRModule.h | ||
| FunctionHLSLs | TArray< const MIR::FFunctionHLSL * > | Array of HLSL-defined user-functions in the module. | Materials/MaterialIRModule.h | |
| IntegerEnvironmentDefines | TArray< TPair< FName, int32 > > | Materials/MaterialIRModule.h | ||
| InternedStrings | TSet< FStringView > | Stores the set of user generated interned strings in this module. | Materials/MaterialIRModule.h | |
| ParameterCollections | TArray< UMaterialParameterCollection * > | Parameter collections referenced by this module. | Materials/MaterialIRModule.h | |
| ParameterIdToData | TArray< TPair< FMaterialParameterInfo, FMaterialParameterMetadata > > | Parameter metadata. | Materials/MaterialIRModule.h | |
| ParameterInfoToId | TMap< FMaterialParameterInfo, uint32 > | Maps parameter info to IDs. | Materials/MaterialIRModule.h | |
| PropertyValues | MIR::FValue * | The final value assigned to each concrete material property. | Materials/MaterialIRModule.h | |
| QualityLevel | EMaterialQualityLevel::Type | Target quality level. | Materials/MaterialIRModule.h | |
| ShaderPlatform | EShaderPlatform | Target shader platform. | Materials/MaterialIRModule.h | |
| ShadingModelsFromCompilation | FMaterialShadingModelField | Shading models used by this material. | Materials/MaterialIRModule.h | |
| Statistics | FStatistics | Compilation statistics. | Materials/MaterialIRModule.h | |
| SubstrateData | FSubstrateData | Substrate compiled data. | Materials/MaterialIRModule.h | |
| TargetPlatform | const ITargetPlatform * | Materials/MaterialIRModule.h | ||
| Values | TArray< MIR::FValue * > | Array of all the IR values contained in this module. | Materials/MaterialIRModule.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
void AddCustomOutput
(
const MIR::FSetMaterialOutput* Instr |
Records a custom output instruction. | Materials/MaterialIRModule.h | |
int32 AddEntryPoint
(
FStringView Name, |
Adds a new entry point with specified name, stage and optionally the expected number of evaluated output values hint. | Materials/MaterialIRModule.h | |
void AddEnvironmentDefine
(
FName Name |
Adds an environment define. | Materials/MaterialIRModule.h | |
void AddError
(
UMaterialExpression* Source, |
Reports a translation error. | Materials/MaterialIRModule.h | |
void AddFunctionHLSL
(
const MIR::FFunctionHLSL* Function |
Adds an HLSL function in the module. | Materials/MaterialIRModule.h | |
void AddIntegerEnvironmentDefine
(
FName Name, |
Temporary. @massimo.tristano refactor this. | Materials/MaterialIRModule.h | |
void AddShadingModel
(
EMaterialShadingModel InShadingModel |
Flags a shading model as used by this material. | Materials/MaterialIRModule.h | |
void AddValue
(
MIR::FValue* Value |
ADds a value to the module's list of all values. | Materials/MaterialIRModule.h | |
void * Allocate
(
size_t Size, |
Allocates a chunk of memory using the module's internal memory block, to be used by the user as they see fit. | Materials/MaterialIRModule.h | |
TArrayView< T > AllocateArray
(
int32 Count |
Allocates an array of elements using the module's internal memory block, to be used by the user as they see fit. | Materials/MaterialIRModule.h | |
void BeginCustomOutputGroup
(
FStringView Name, |
Materials/MaterialIRModule.h | ||
void Empty() |
Clears the module, releasing all stored data. | Materials/MaterialIRModule.h | |
int32 FindOrAddParameterCollection
(
UMaterialParameterCollection* ParameterCollection |
Find existing or add a material parameter collection may return INDEX_NONE if too many have already been added. | Materials/MaterialIRModule.h | |
EBlendMode GetBlendMode() |
Returns the blend mode associated with this module. | Materials/MaterialIRModule.h | |
| Materials/MaterialIRModule.h | |||
const FMaterialCompilationOutput & GetCompilationOutput () |
Retrieves the material compilation output. | Materials/MaterialIRModule.h | |
FMaterialShadingModelField GetCompiledShadingModels() |
Returns the shading models used by this material. | Materials/MaterialIRModule.h | |
TConstArrayView< FCustomOutputGroup > GetCustomOutputGroups() |
Returns the array custom output groups. | Materials/MaterialIRModule.h | |
TConstArrayView< const MIR::FSetMaterialOutput * > GetCustomOutputs() |
Returns the array custom output instructions. | Materials/MaterialIRModule.h | |
const FEntryPoint & GetEntryPoint
(
int32 Index |
Materials/MaterialIRModule.h | ||
FEntryPoint & GetEntryPoint
(
int32 Index |
Gets the entry point of given Index previously added with AddEntryPoint(). | Materials/MaterialIRModule.h | |
const TSet< FName > & GetEnvironmentDefines() |
Returns a list of all environment define names this module requires to be enabled for shader compilation. @massimo.tristano refactor this. | Materials/MaterialIRModule.h | |
TArrayView< const FError > GetErrors() |
Returns a list of errors encountered during processing. | Materials/MaterialIRModule.h | |
ERHIFeatureLevel::Type GetFeatureLevel() |
Returns the feature level associated with this module. | Materials/MaterialIRModule.h | |
TConstArrayView< const MIR::FFunctionHLSL * > GetFunctionHLSLs() |
Returns the array of HLSL-defined user-functions in the module. | Materials/MaterialIRModule.h | |
TConstArrayView< TPair< FName, int32 > > GetIntegerEnvironmentDefines() |
Temporary. @massimo.tristano refactor this. | Materials/MaterialIRModule.h | |
int32 GetNumEntryPoints() |
Returns the number of procedures inthe module. | Materials/MaterialIRModule.h | |
TConstArrayView< UMaterialParameterCollection * > GetParameterCollections() |
Returns the list of material parameter collections used by this material. | Materials/MaterialIRModule.h | |
const FMaterialParameterInfo & GetParameterInfo
(
uint32 ParameterId |
Retrieves parameter info for a given parameter ID. | Materials/MaterialIRModule.h | |
const FMaterialParameterMetadata & GetParameterMetadata
(
uint32 ParameterId |
Retrieves parameter metadata for a given parameter ID. | Materials/MaterialIRModule.h | |
const MIR::FValue * GetPropertyValue
(
EMaterialProperty Property |
Retrieves the value a meterial property is assigned to. | Materials/MaterialIRModule.h | |
EMaterialQualityLevel::Type GetQualityLevel() |
Returns the quality level associated with this module. | Materials/MaterialIRModule.h | |
EShaderPlatform GetShaderPlatform() |
Returns the shader platform associated with this module. | Materials/MaterialIRModule.h | |
const FStatistics & GetStatistics () |
Provides access to the translated material statistics. | Materials/MaterialIRModule.h | |
FStatistics & GetStatistics () |
Provides mutable access to the translated material statistics. | Materials/MaterialIRModule.h | |
const FSubstrateData & GetSubstrateData() |
Materials/MaterialIRModule.h | ||
const ITargetPlatform * GetTargetPlatform() |
Returns the target platform interface associated with this module. | Materials/MaterialIRModule.h | |
FStringView InternString
(
FStringView InString |
Stores a user-defined string and returns a view of it. | Materials/MaterialIRModule.h | |
bool IsMaterialPropertyUsed
(
EMaterialProperty InProperty |
Returns true if the given property has a non default value. Similar to FHLSLMaterialTranslator::IsMaterialPropertyUsed. | Materials/MaterialIRModule.h | |
bool IsValid() |
Checks if the module is valid (i.e., contains no errors). | Materials/MaterialIRModule.h | |
void SetPropertyValue
(
EMaterialProperty Property, |
Sets the value of a material property for future reference. | Materials/MaterialIRModule.h |