UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
Preshader.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2#pragma once
3
4#include "CoreMinimal.h"
8
11class FMaterial;
13
14namespace UE
15{
16namespace Shader
17{
18
20{
21 Nop,
25 Add,
26 Sub,
27 Mul,
28 Div,
29 Fmod,
30 Modulo,
31 Min,
32 Max,
33 Clamp,
34 Sin,
35 Cos,
36 Tan,
37 Asin,
38 Acos,
39 Atan,
40 Atan2,
41 Dot,
42 Cross,
43 Sqrt,
44 Rcp,
45 Length,
48 Abs,
49 Floor,
50 Ceil,
51 Round,
52 Trunc,
53 Sign,
54 Frac,
56 Log2,
57 Log10,
68 Neg,
69 Jump,
72 Less,
73 Assign,
74 Greater,
77 Exp,
78 Exp2,
79 Log
80};
81
89
91{
92 explicit FPreshaderLabel(int32 InOffset = INDEX_NONE) : Offset(InOffset) {}
93
95};
96
98{
100public:
101 friend inline bool operator==(const FPreshaderData& Lhs, const FPreshaderData& Rhs)
102 {
103 return Lhs.Names == Rhs.Names && Lhs.Data == Rhs.Data;
104 }
105
106 friend inline bool operator!=(const FPreshaderData& Lhs, const FPreshaderData& Rhs)
107 {
108 return !operator==(Lhs, Rhs);
109 }
110
112
113 FPreshaderValue Evaluate(FUniformExpressionSet* UniformExpressionSet, const struct FMaterialRenderContext& Context, FPreshaderStack& Stack) const;
115
116 const int32 Num() const { return Data.Num(); }
117
118 void WriteData(const void* Value, uint32 Size);
119 void WriteName(const FScriptName& Name);
120 void WriteType(const FType& Type);
121 void WriteValue(const FValue& Value);
122
125
128
129 template<typename T>
130 FPreshaderData& Write(const T& Value) { WriteData(&Value, sizeof(T)); return *this; }
131
132 template<>
134
135 template<>
137
138 template<>
140
142 template<>
144
145 template<>
147
149
154};
155
156} // namespace Shader
157} // namespace UE
#define ensure( InExpression)
Definition AssertionMacros.h:464
@ INDEX_NONE
Definition CoreMiscDefines.h:150
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
FPlatformTypes::uint64 uint64
A 64-bit unsigned integer.
Definition Platform.h:1117
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
#define DECLARE_TYPE_LAYOUT(T, Interface)
Definition MemoryLayout.h:557
uint32 Size
Definition VulkanMemory.cpp:4034
uint8_t uint8
Definition binka_ue_file_header.h:8
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition MaterialShared.h:2058
Definition NameTypes.h:617
Definition MaterialShared.h:666
Definition xxhash.h:181
Definition Array.h:670
Definition Preshader.h:98
void WriteValue(const FValue &Value)
Definition Preshader.cpp:273
void AppendHash(FXxHash64Builder &OutHasher) const
Definition Preshader.cpp:1525
LAYOUT_FIELD(TMemoryImageArray< uint8 >, Data)
FPreshaderData & Write(const FHashedMaterialParameterInfo &Value)
Definition Preshader.h:146
void WriteType(const FType &Type)
Definition Preshader.cpp:243
void WriteName(const FScriptName &Name)
Definition Preshader.cpp:231
FPreshaderLabel GetLabel()
Definition Preshader.cpp:317
void SetLabel(FPreshaderLabel InLabel)
Definition Preshader.cpp:305
LAYOUT_FIELD(TMemoryImageArray< EValueComponentType >, StructComponentTypes)
FPreshaderData & WriteOpcode(EPreshaderOpcode Op)
Definition Preshader.h:148
FPreshaderData & Write(const T &Value)
Definition Preshader.h:130
friend bool operator!=(const FPreshaderData &Lhs, const FPreshaderData &Rhs)
Definition Preshader.h:106
friend bool operator==(const FPreshaderData &Lhs, const FPreshaderData &Rhs)
Definition Preshader.h:101
FPreshaderValue EvaluateConstant(const FMaterial &Material, FPreshaderStack &Stack) const
Definition Preshader.cpp:1519
LAYOUT_FIELD(TMemoryImageArray< FPreshaderStructType >, StructTypes)
const int32 Num() const
Definition Preshader.h:116
void WriteData(const void *Value, uint32 Size)
Definition Preshader.cpp:226
FPreshaderLabel WriteJump(EPreshaderOpcode Op)
Definition Preshader.cpp:289
FPreshaderValue Evaluate(FUniformExpressionSet *UniformExpressionSet, const struct FMaterialRenderContext &Context, FPreshaderStack &Stack) const
Definition Preshader.cpp:1513
LAYOUT_FIELD(TMemoryImageArray< FScriptName >, Names)
Definition PreshaderTypes.h:42
EPreshaderOpcode
Definition Preshader.h:20
Definition AdvancedWidgetsModule.cpp:13
Definition MaterialShared.h:349
Definition MaterialParameters.h:96
Definition NameTypes.h:491
Definition Preshader.h:91
FPreshaderLabel(int32 InOffset=INDEX_NONE)
Definition Preshader.h:92
int32 Offset
Definition Preshader.h:94
Definition Preshader.h:83
LAYOUT_FIELD(int32, ComponentTypeIndex)
LAYOUT_FIELD(int32, NumComponents)
DECLARE_TYPE_LAYOUT(FPreshaderStructType, NonVirtual)
Definition PreshaderTypes.h:33
Definition ShaderTypes.h:181
Definition ShaderTypes.h:368