UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
MaterialIRCommon.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2#pragma once
3
4#include "SceneTypes.h"
5#include "RHIShaderPlatform.h"
6#include "Containers/Array.h"
7#include "Math/MathFwd.h"
8#include "Misc/MemStack.h"
9
10#if WITH_EDITOR
11
12/* Forward declarations */
13
14class FMaterial;
16class ITargetPlatform;
17class UMaterial;
21class UTexture;
23struct FExpressionInput;
32
33namespace UE::Shader
34{
35 struct FValue;
36}
37
38namespace ERHIFeatureLevel { enum Type : int; }
39
40namespace MIR
41{
42
43/* Types*/
44struct FType;
45struct FPrimitive;
46struct FObjectType;
47struct FAggregateType;
48
49/* IR */
50struct FValue;
51struct FInstruction;
53enum class EExternalInput;
54
55/* Others */
56class FEmitter;
57struct FBlock;
58
59namespace Internal
60{
61 uint32 HashBytes(const char* Ptr, uint32 Size);
62}
63
64/* Helper structures */
65
66// Use this to efficiently allocate a temporary array using MemStack, instead
67// of using TArray and going through the global allocator. Only declare local variable
68// of this struct (i.e. do not "new TTemporaryArray")
69// Remark: The allocated memory lifespan is the same as the TTemporaryArray local variable
70// (it is deallocated when TTemporaryArray goes out of scope).
71template <typename T>
72struct TTemporaryArray : public TArrayView<T>
73{
75
77 : MemMark{ FMemStack::Get() }
78 {
79 *static_cast<TArrayView<T>*>(this) = { (T*)FMemStack::Get().Alloc(sizeof(T) * Num, alignof(T)), Num };
80 }
81
82 operator TConstArrayView<T>() const
83 {
85 }
86
87 void Zero()
88 {
90 }
91};
92
93template <typename T>
95{
97 FMemory::Memzero(Array.GetData(), Array.Num() * sizeof(T));
98}
99
100}
101
102#define UE_MIR_UNREACHABLE() { check(!"Unreachable"); UE_ASSUME(false); }
103#define UE_MIR_TODO() UE_MIR_UNREACHABLE()
104
105#endif // #if WITH_EDITOR
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
@ Num
Definition MetalRHIPrivate.h:234
EMaterialProperty
Definition SceneTypes.h:148
uint32 Size
Definition VulkanMemory.cpp:4034
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition MaterialShared.h:2058
Definition MemStack.h:506
void * Alloc(size_t AllocSize, size_t Alignment)
Definition MemStack.h:132
Definition MemStack.h:245
Definition ArrayView.h:139
UE_FORCEINLINE_HINT constexpr ElementType * GetData() const
Definition ArrayView.h:295
UE_FORCEINLINE_HINT constexpr SizeType Num() const
Definition ArrayView.h:380
static FORCEINLINE FMemStack & Get()
Definition ThreadSingleton.h:101
Definition MaterialAggregate.h:82
Definition MaterialExpressionMaterialFunctionCall.h:81
Definition MaterialExpression.h:150
Definition Material.h:432
Definition Texture.h:1219
Definition SceneComponent.h:24
Type
Definition RHIFeatureLevel.h:20
Definition ByteSwap.h:14
Definition MaterialExpression.h:36
FORCEINLINE T * Get(const FObjectPtr &ObjectPtr)
Definition ObjectPtr.h:426
int
Definition TestServer.py:515
FDocument::ValueType FValue
Definition RapidJsonUtils.h:61
Definition SparseVolumeTexture.h:19
Definition MaterialExpressionIO.h:23
Definition MaterialExpressionIO.h:115
Definition MaterialAggregate.h:52
Definition Material.h:270
A structure that holds reflection information about a material. This structure is typically populated...
Definition MaterialInsights.h:21
static UE_FORCEINLINE_HINT void * Memzero(void *Dest, SIZE_T Count)
Definition UnrealMemory.h:131
Definition ShaderCore.h:544
Definition StaticParameterSet.h:462
Definition IsTriviallyCopyAssignable.h:13