budget
budget
#Overview
name: budget
This variable is created as a Console Variable (cvar).
- type:
Exec
- help:
Sorry: Exec commands have no help
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of the ‘budget’ variable is to control resource allocation and limit operations in various parts of Unreal Engine 5. It serves different functions depending on the context in which it’s used.
This setting variable is used in multiple Unreal Engine subsystems and modules:
- In the GeometryProcessing plugin, specifically in the edge splitting algorithm of the fTetWild library.
- In the CSVtoSVG editor tool.
- In the Core runtime module, specifically in the stats system.
The value of this variable is set differently in each context:
- In the edge splitting algorithm, it’s set as an input parameter (initially -1).
- In the CSVtoSVG tool, it’s set as a default value of 33.3f, which can be modified through the editor interface.
- In the stats system, it’s not directly set but used as a command identifier.
The ‘budget’ variable interacts with other variables depending on the context:
- In edge splitting, it interacts with ‘v_slots’ and ’t_slots’ to control memory allocation.
- In CSVtoSVG, it’s part of a set of configurable parameters for the tool.
- In the stats system, it’s used alongside ‘bStatCommand’ to determine command behavior.
Developers should be aware of the following when using this variable:
- In edge splitting, a negative budget means unlimited operations, while a positive value limits the number of splits.
- In CSVtoSVG, the budget represents milliseconds and affects the budget line in the generated SVG.
- In the stats system, it’s used as a command identifier and doesn’t represent a numerical budget.
Best practices when using this variable include:
- In edge splitting, carefully consider the trade-off between mesh quality and performance when setting a budget.
- In CSVtoSVG, adjust the budget value based on the target frame rate of your project.
- In the stats system, be aware of the ‘budget’ command when working with performance statistics.
Always consider the specific context and module when working with the ‘budget’ variable, as its meaning and usage vary across different parts of the engine.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Plugins/Runtime/GeometryProcessing/Source/GeometryAlgorithms/Private/ThirdParty/fTetWild/EdgeSplitting.cpp:40
Scope (from outer to inner):
file
function void floatTetWild::edge_splitting
Source code excerpt:
////split
int budget = -1;//input
if (budget > 0) {
int v_slots = mesh.v_empty_size();
v_slots = budget - v_slots;
if (v_slots > 0) {
tet_vertices.reserve(tet_vertices.size() + v_slots);
}
int t_slots = mesh.t_empty_size();
t_slots = budget * 6 - t_slots;
if (t_slots > 0) {
tets.reserve(tet_vertices.size() + t_slots);
}
} else {
// reserve space
int v_slots = mesh.v_empty_size();
#Loc: <Workspace>/Engine/Plugins/Runtime/GeometryProcessing/Source/GeometryAlgorithms/Private/ThirdParty/fTetWild/EdgeSplitting.cpp:87
Scope (from outer to inner):
file
function void floatTetWild::edge_splitting
Source code excerpt:
counter++;
if (budget > 0) {
budget--;
if (budget == 0)
break;
}
}
for(auto& t: tets){
if(t.is_removed)
#Loc: <Workspace>/Engine/Source/Editor/CSVtoSVG/Public/CSVtoSVGArguments.h:81
Scope (from outer to inner):
file
class class UCSVtoSVGArugments : public UEditorConfigBase
Source code excerpt:
UPROPERTY(EditAnywhere, Category = OptionalArguments, meta = (EditorConfig, DisplayName = "Budget [ms]", Tooltip = "Sets the budget line. Default is 33.3."))
float budget = 33.3f;
UPROPERTY(EditAnywhere, Category = OptionalArguments, meta = (EditorConfig, DisplayName = "Thickness", Tooltip = "Sets the line thickness of the graph."))
float thickness = 1.0f;
UPROPERTY(EditAnywhere, Category = OptionalArguments, meta = (EditorConfig, DisplayName = "Theme", Tooltip = ""))
ESVGTheme theme = ESVGTheme::Dark;
#Loc: <Workspace>/Engine/Source/Runtime/Core/Private/Stats/StatsCommand.cpp:2205
Scope (from outer to inner):
file
function bool DirectStatsCommand
Source code excerpt:
bool bResult = false;
const bool bStatCommand = FParse::Command(&Cmd,TEXT("stat"));
const bool bBudgetCommand = FParse::Command(&Cmd,TEXT("budget"));
if(bStatCommand || bBudgetCommand)
{
FString AddArgs;
const TCHAR* TempCmd = Cmd;