p.SerializeSQsSweepEnabled
p.SerializeSQsSweepEnabled
#Overview
name: p.SerializeSQsSweepEnabled
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
If disabled, p.SerializeSQs will not consider sweeps
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.SerializeSQsSweepEnabled is to control the serialization of sweep scene queries (SQs) in the Unreal Engine’s collision system. It is part of the engine’s debugging and performance analysis toolset for collision detection.
This setting variable is primarily used by the collision system within Unreal Engine’s physics module. Based on the callsites, it’s clear that this variable is utilized in the scene query low-level operations, specifically in the SceneQueryLowLevel.cpp
file.
The value of this variable is set through the Unreal Engine’s console variable system. It’s defined as an FAutoConsoleVariableRef
, which means it can be changed at runtime through console commands or configuration files.
The p.SerializeSQsSweepEnabled variable interacts directly with the EnableSweepSQCapture variable. They share the same value, and EnableSweepSQCapture is used in the actual code logic to determine whether sweep SQs should be serialized.
Developers should be aware that enabling this variable can have performance implications. When enabled, it allows for the creation of scene query captures for sweeps, which can be useful for debugging but may impact performance, especially in complex scenes.
Best practices when using this variable include:
- Only enable it when necessary for debugging or performance analysis.
- Be cautious when enabling in production builds, as it can affect performance.
- Use in conjunction with other SQ serialization variables (p.SerializeSQsRaycastEnabled and p.SerializeSQsOverlapEnabled) for comprehensive collision analysis.
Regarding the associated variable EnableSweepSQCapture:
The purpose of EnableSweepSQCapture is to act as the internal flag that controls whether sweep scene queries should be captured and serialized. It’s directly linked to the p.SerializeSQsSweepEnabled console variable.
This variable is used within the collision system’s low-level sweep operations. It’s checked in the LowLevelSweep function to determine whether to perform the SweepSQCaptureHelper operation.
The value of EnableSweepSQCapture is set based on the p.SerializeSQsSweepEnabled console variable. It’s initialized to 1 (enabled) by default, but can be changed through the console variable system.
EnableSweepSQCapture interacts primarily with the SerializeSQs variable. Both need to be true for sweep SQ capture to occur.
Developers should be aware that this variable directly affects the behavior of sweep scene queries and can impact performance when enabled.
Best practices for EnableSweepSQCapture are similar to those for p.SerializeSQsSweepEnabled, as they are closely linked. It’s important to use this variable judiciously and primarily for debugging and analysis purposes.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Collision/SceneQueryLowLevel.cpp:29
Scope: file
Source code excerpt:
FAutoConsoleVariableRef CVarSerializeSQsRaycastEnabled(TEXT("p.SerializeSQsRaycastEnabled"), EnableRaycastSQCapture, TEXT("If disabled, p.SerializeSQs will not consider raycasts"));
FAutoConsoleVariableRef CVarSerializeSQsOverlapEnabled(TEXT("p.SerializeSQsOverlapEnabled"), EnableOverlapSQCapture, TEXT("If disabled, p.SerializeSQs will not consider overlaps"));
FAutoConsoleVariableRef CVarSerializeSQsSweepEnabled(TEXT("p.SerializeSQsSweepEnabled"), EnableSweepSQCapture, TEXT("If disabled, p.SerializeSQs will not consider sweeps"));
#else
constexpr int32 SerializeSQs = 0;
constexpr int32 ReplaySQs = 0;
constexpr int32 SerializeSQSamples = 0;
constexpr int32 EnableRaycastSQCapture = 0;
constexpr int32 EnableOverlapSQCapture = 0;
#Associated Variable and Callsites
This variable is associated with another variable named EnableSweepSQCapture
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Collision/SceneQueryLowLevel.cpp:21
Scope: file
Source code excerpt:
int32 EnableRaycastSQCapture = 1;
int32 EnableOverlapSQCapture = 1;
int32 EnableSweepSQCapture = 1;
FAutoConsoleVariableRef CVarSerializeSQs(TEXT("p.SerializeSQs"), SerializeSQs, TEXT("If enabled, we create a sq capture per sq that takes more than provided value in microseconds. This can be very expensive as the entire scene is saved out"));
FAutoConsoleVariableRef CVarSerializeSQSamples(TEXT("p.SerializeSQSampleCount"), SerializeSQSamples, TEXT("If Query exceeds duration threshold, we will re-measure SQ this many times before serializing. Larger values cause hitching."));
FAutoConsoleVariableRef CVarReplaySweeps(TEXT("p.ReplaySQs"), ReplaySQs, TEXT("If enabled, we rerun the sq against chaos"));
FAutoConsoleVariableRef CVarSerializeBadSweeps(TEXT("p.SerializeBadSQs"), SerializeBadSQs, TEXT("If enabled, we create a sq capture whenever chaos and physx diverge"));
FAutoConsoleVariableRef CVarSerializeSQsRaycastEnabled(TEXT("p.SerializeSQsRaycastEnabled"), EnableRaycastSQCapture, TEXT("If disabled, p.SerializeSQs will not consider raycasts"));
FAutoConsoleVariableRef CVarSerializeSQsOverlapEnabled(TEXT("p.SerializeSQsOverlapEnabled"), EnableOverlapSQCapture, TEXT("If disabled, p.SerializeSQs will not consider overlaps"));
FAutoConsoleVariableRef CVarSerializeSQsSweepEnabled(TEXT("p.SerializeSQsSweepEnabled"), EnableSweepSQCapture, TEXT("If disabled, p.SerializeSQs will not consider sweeps"));
#else
constexpr int32 SerializeSQs = 0;
constexpr int32 ReplaySQs = 0;
constexpr int32 SerializeSQSamples = 0;
constexpr int32 EnableRaycastSQCapture = 0;
constexpr int32 EnableOverlapSQCapture = 0;
constexpr int32 EnableSweepSQCapture = 0;
#endif
namespace
{
void FinalizeCapture(FPhysTestSerializer& Serializer)
{
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Collision/SceneQueryLowLevel.cpp:308
Scope (from outer to inner):
file
function void LowLevelSweep
Source code excerpt:
if constexpr (bGTData && FAccelerationContainerTraits<TAccelContainer, bGTData>::IsPhysScene())
{
if(!!SerializeSQs && !!EnableSweepSQCapture)
{
SweepSQCaptureHelper(Time, SQAccelerator, Container, QueryGeom, StartTM, Dir, DeltaMag, HitBuffer, OutputFlags, QueryFlags, Filter, QueryFilterData, QueryCallback, DebugParams);
}
}
}
}