UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
VectorVMEditor.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2#pragma once
3
4#include "VectorVM.h"
5#include "VectorVMTypes.h"
6
7#define VVM_OP_CAT_XM_LIST \
8 VVM_OP_CAT_XM(Input) \
9 VVM_OP_CAT_XM(Output) \
10 VVM_OP_CAT_XM(Op) \
11 VVM_OP_CAT_XM(ExtFnCall) \
12 VVM_OP_CAT_XM(IndexGen) \
13 VVM_OP_CAT_XM(RWBuffer) \
14 VVM_OP_CAT_XM(Stat) \
15 VVM_OP_CAT_XM(Other)
16
17#define VVM_OP_CAT_XM(Category, ...) Category,
22#undef VVM_OP_CAT_XM
23
24static const EVectorVMOpCategory VVM_OP_CATEGORIES[] = {
25#define VVM_OP_XM(op, cat, ...) EVectorVMOpCategory::cat,
27#undef VVM_OP_XM
28};
29
30#if WITH_EDITORONLY_DATA
31
32namespace VectorVM::Optimizer
33{
34
35enum
36{
42};
43
45
46//prototypes for optimizer
48
49//Optimization
51{
56 int Index; //initial index. Instructions are moved around and removed and dependency chains are created based on index, so we need to store this.
57 int InsMergedIdx; //if not -1, then the instruction index that this is merged with. Instructions with a set InsMergedIdx are not written to the final bytecode
58 int OutputMergeIdx[2]; //if not -1 then this instruction writes directly to an output, not a temp register
62 union
63 {
64 struct
65 {
68 } Input;
69 struct
70 {
73 int MergeIdx; //if not -1 then this instruction index is merged with an output or an op, if it's -2 then it's already been taken care of
75 } Output;
76 struct
77 {
78
79 } Op;
80 struct
81 {
83 } IndexGen;
84 struct
85 {
87 uint16 NumInputs;
89 } ExtFnCall;
90 struct
91 {
93 } RWBuffer;
94 struct
95 {
96 uint16 ID;
97 } Stat;
98 struct
99 {
100 } Other;
101 };
102};
103
105{
106 VVMOptErr_OutOfMemory = 1 << 0,
107 VVMOptErr_Overflow = 1 << 1,
108 VVMOptErr_Bytecode = 1 << 2,
110 VVMOptErr_ConstRemap = 1 << 4,
111 VVMOptErr_Instructions = 1 << 5,
114 VVMOptErr_SSARemap = 1 << 8,
118
119 VVMOptErr_Fatal = 1 << 31
120};
121
122typedef void* (VectorVMReallocFn)(void* Ptr, size_t NumBytes, const char* Filename, int LineNumber);
123typedef void (VectorVMFreeFn)(void* Ptr, const char* Filename, int LineNumber);
124
126{
128
129 struct
130 {
131 VectorVMReallocFn * ReallocFn = nullptr;
132 VectorVMFreeFn * FreeFn = nullptr;
133 const char * ScriptName = nullptr;
134 } Init; //Set this stuff when calling Optimize()
135
136 struct
137 {
138 uint32 Flags = 0; //zero is good
139 uint32 Line = 0;
140 VectorVMOptimizerErrorCallback* CallbackFn = nullptr; //set this to get a callback whenever there's an error
141 } Error;
142
143 struct
144 {
146 uint8* RegisterUsageType = nullptr;
147 uint16* RegisterUsageBuffer = nullptr;
149 uint16* ParentInstructionIdx = nullptr;
150 uint32 NumInstructions = 0;
153 } Intermediate; //these are freed and NULL after optimize() unless SaveIntermediateData is true when calling OptimizeVectorVMScript
154};
155
156}
157
158#endif
OODEFFUNC typedef void(OODLE_CALLBACK t_fp_OodleCore_Plugin_Free)(void *ptr)
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
void Init()
Definition LockFreeList.h:4
#define VVM_OP_CAT_XM_LIST
Definition VectorVMEditor.h:7
EVectorVMOpCategory
Definition VectorVMEditor.h:18
#define VVM_OP_XM_LIST
Definition VectorVM.h:50
EVectorVMOp
Definition VectorVM.h:237
uint8_t uint8
Definition binka_ue_file_header.h:8
uint16_t uint16
Definition binka_ue_file_header.h:7
uint32_t uint32
Definition binka_ue_file_header.h:6
@ ScriptName
[ClassMetadata] [PropertyMetadata] [FunctionMetadata] The name to use for this class,...
Definition ObjectMacros.h:1243
Definition VectorVMOptimizer.cpp:12
U16 Index
Definition radfft.cpp:71
Definition VectorVMTypes.h:78