FX.ParticleSlackGPU
FX.ParticleSlackGPU
#Overview
name: FX.ParticleSlackGPU
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Amount of slack to allocate for GPU particles to prevent tile churn as percentage of total particles.
It is referenced in 5
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of FX.ParticleSlackGPU is to control the amount of additional memory allocated for GPU particles in Unreal Engine 5’s particle system. This setting helps prevent tile churn by providing a buffer of extra space for particle data.
This setting variable is primarily used in the particle and FX system of Unreal Engine. Based on the callsites, it’s part of the Engine module, specifically within the particle simulation and rendering subsystems.
The value of FX.ParticleSlackGPU is set as a console variable, which means it can be adjusted at runtime. It’s initialized with a default value of 0.02f (2%) in the FXConsoleVariables namespace.
The associated variable ParticleSlackGPU interacts directly with FX.ParticleSlackGPU. They share the same value, with ParticleSlackGPU being the actual float variable used in the code, while FX.ParticleSlackGPU is the console variable name for adjusting it.
Developers should be aware that this variable affects memory allocation for GPU particles. Increasing it will allocate more memory, potentially reducing performance issues caused by frequent reallocation, but at the cost of higher memory usage.
Best practices for using this variable include:
- Monitoring performance and adjusting the value based on specific project needs.
- Keeping the value relatively low (the default is 2%) to avoid excessive memory usage.
- Using it in conjunction with other particle system optimizations.
Regarding the associated variable ParticleSlackGPU:
The purpose of ParticleSlackGPU is to store the actual float value used in calculations for GPU particle memory allocation.
It’s used directly in the particle system, specifically in the FGPUSpriteParticleEmitterInstance class for calculating the minimum tile count for GPU particles.
The value is set through the FX.ParticleSlackGPU console variable.
It interacts with other variables like EmitterInfo.MaxParticleCount and FXConsoleVariables::MaxParticleTilePreAllocation in calculations.
Developers should be aware that changing this value affects the memory allocation strategy for GPU particles, which can impact performance and memory usage.
Best practices include carefully tuning this value based on profiling results and specific project requirements, and considering its impact on overall GPU memory usage in the particle system.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Particles/FXSystem.cpp:170
Scope (from outer to inner):
file
namespace FXConsoleVariables
Source code excerpt:
);
FAutoConsoleVariableRef CVarParticleSlackGPU(
TEXT("FX.ParticleSlackGPU"),
ParticleSlackGPU,
TEXT("Amount of slack to allocate for GPU particles to prevent tile churn as percentage of total particles."),
ECVF_Cheat
);
FAutoConsoleVariableRef CVarMaxParticleTilePreAllocation(
TEXT("FX.MaxParticleTilePreAllocation"),
#Associated Variable and Callsites
This variable is associated with another variable named ParticleSlackGPU
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Particles/FXSystem.cpp:127
Scope (from outer to inner):
file
namespace FXConsoleVariables
Source code excerpt:
int32 bFreezeParticleSimulation = false;
int32 bAllowAsyncTick = !WITH_EDITOR;
float ParticleSlackGPU = 0.02f;
int32 MaxParticleTilePreAllocation = 100;
int32 MaxCPUParticlesPerEmitter = 1000;
int32 MaxGPUParticlesSpawnedPerFrame = 1024 * 1024;
int32 GPUSpawnWarningThreshold = 20000;
float GPUCollisionDepthBounds = 500.0f;
TAutoConsoleVariable<int32> TestGPUSort(TEXT("FX.TestGPUSort"),0,TEXT("Test GPU sort. 1: Small, 2: Large, 3: Exhaustive, 4: Random"),ECVF_Cheat);
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Particles/FXSystem.cpp:171
Scope (from outer to inner):
file
namespace FXConsoleVariables
Source code excerpt:
FAutoConsoleVariableRef CVarParticleSlackGPU(
TEXT("FX.ParticleSlackGPU"),
ParticleSlackGPU,
TEXT("Amount of slack to allocate for GPU particles to prevent tile churn as percentage of total particles."),
ECVF_Cheat
);
FAutoConsoleVariableRef CVarMaxParticleTilePreAllocation(
TEXT("FX.MaxParticleTilePreAllocation"),
MaxParticleTilePreAllocation,
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Particles/ParticleGpuSimulation.cpp:3932
Scope (from outer to inner):
file
class class FGPUSpriteParticleEmitterInstance : public FParticleEmitterInstance
function int32 GetMinTileCount
Source code excerpt:
{
const int32 EstMaxTiles = (EmitterInfo.MaxParticleCount + GParticlesPerTile - 1) / GParticlesPerTile;
const int32 SlackTiles = FMath::CeilToInt(FXConsoleVariables::ParticleSlackGPU * (float)EstMaxTiles);
return FMath::Min<int32>(EstMaxTiles + SlackTiles, FXConsoleVariables::MaxParticleTilePreAllocation);
}
return 0;
}
/**
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/FXSystem.h:73
Scope (from outer to inner):
file
namespace FXConsoleVariables
Source code excerpt:
extern int32 bAllowAsyncTick;
/** Amount of slack to allocate for GPU particles to prevent tile churn as percentage of total particles. */
extern float ParticleSlackGPU;
/** Maximum tile preallocation for GPU particles. */
extern int32 MaxParticleTilePreAllocation;
/** Maximum number of CPU particles to allow per-emitter. */
extern int32 MaxCPUParticlesPerEmitter;
/** Maximum number of GPU particles to spawn per-frame. */
extern int32 MaxGPUParticlesSpawnedPerFrame;