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 |
|---|---|
| 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. |
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 | |
| EntryPoints | TArray< FEntryPoint > | Array of entry points in this module. | Materials/MaterialIRModule.h | |
| EnvironmentDefines | TSet< FName > | Environment define names for shader compilation. | 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 | |
| ParameterCollections | TArray< UMaterialParameterCollection * > | Parameter collections used by this material. | 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 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 | |
| TargetPlatform | const ITargetPlatform * | Materials/MaterialIRModule.h | ||
| UserStrings | TArray< FString > | Stores user-defined strings. | Materials/MaterialIRModule.h | |
| Values | TArray< MIR::FValue * > | List of all the IR values contained in this module. | Materials/MaterialIRModule.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
int32 AddEntryPoint
(
FStringView Name, |
Adds a new entry point with specified name, stage and expected number of evaluated output values. | Materials/MaterialIRModule.h | |
void AddError
(
UMaterialExpression* Expression, |
Reports a translation error. | Materials/MaterialIRModule.h | |
void AddShadingModel
(
EMaterialShadingModel InShadingModel |
Flags a shading model as used by this material. | 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 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 | |
const FMaterialCompilationOutput & GetCompilationOutput() |
Retrieves the material compilation output. | Materials/MaterialIRModule.h | |
FMaterialShadingModelField GetCompiledShadingModels() |
Returns the shading models used by this material. | 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. | 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 | |
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 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 |