p.SerializeSQsRaycastEnabled

p.SerializeSQsRaycastEnabled

#Overview

name: p.SerializeSQsRaycastEnabled

This variable is created as a Console Variable (cvar).

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of p.SerializeSQsRaycastEnabled is to control whether raycasts are considered during scene query (SQ) serialization in Unreal Engine’s collision system. This setting variable is part of the engine’s debugging and performance analysis tools for physics and collision detection.

This variable is primarily used in the collision subsystem of Unreal Engine, specifically in the scene query and physics modules. Based on the callsites, it’s evident that this setting is utilized in the Engine’s collision and physics-related code.

The value of this variable is set through a console variable (CVar) named “p.SerializeSQsRaycastEnabled”. It’s associated with the EnableRaycastSQCapture variable, which shares the same value.

Several other variables interact with it, including:

Developers should be aware that:

  1. This variable is primarily used for debugging and performance analysis.
  2. Enabling this variable may have performance implications, as it allows for the creation of SQ captures for raycasts.
  3. It works in conjunction with other serialization settings to provide a comprehensive debugging environment for physics and collision queries.

Best practices when using this variable include:

  1. Only enable it when necessary for debugging or performance analysis of raycast operations.
  2. Use it in combination with other SQ serialization settings for a complete picture of collision query performance.
  3. Be mindful of the potential performance impact when enabled, especially in production environments.

Regarding the associated variable EnableRaycastSQCapture:

The purpose of EnableRaycastSQCapture is to directly control whether raycast scene queries are captured for serialization. It’s used internally by the engine to implement the functionality controlled by p.SerializeSQsRaycastEnabled.

This variable is used in the same collision and physics subsystems as p.SerializeSQsRaycastEnabled. It’s referenced in the LowLevelRaycast function, indicating its direct involvement in the raycast process.

The value of EnableRaycastSQCapture is set by the p.SerializeSQsRaycastEnabled console variable.

Developers should be aware that:

  1. This variable directly affects the behavior of raycast operations when SQ serialization is enabled.
  2. It’s used in conditional statements to determine whether to perform additional operations during raycasts.

Best practices for EnableRaycastSQCapture are similar to those for p.SerializeSQsRaycastEnabled, as they are directly linked. Developers should treat them as essentially the same setting, with EnableRaycastSQCapture being the internal implementation of the console-accessible p.SerializeSQsRaycastEnabled.

#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:27

Scope: file

Source code excerpt:

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;

#Associated Variable and Callsites

This variable is associated with another variable named EnableRaycastSQCapture. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Collision/SceneQueryLowLevel.cpp:19

Scope: file

Source code excerpt:

int32 SerializeBadSQs = 0;
int32 ReplaySQs = 0;
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
{

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Collision/SceneQueryLowLevel.cpp:274

Scope (from outer to inner):

file
function     void LowLevelRaycast

Source code excerpt:

		if constexpr (bGTData && TTraits::IsPhysScene())
		{
			if (!!SerializeSQs && !!EnableRaycastSQCapture)
			{
				RaycastSQCaptureHelper(Time, SQAccelerator, Container, Start, Dir, DeltaMag, HitBuffer, OutputFlags, QueryFlags, Filter, QueryFilterData, QueryCallback, DebugParams);
			}
		}
	}
}