r.SkinCache.RayTracingUseTransientForScratch
r.SkinCache.RayTracingUseTransientForScratch
#Overview
name: r.SkinCache.RayTracingUseTransientForScratch
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Use Transient memory for BLAS scratch allocation to reduce memory footprint and allocation overhead.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.SkinCache.RayTracingUseTransientForScratch is to control the memory allocation strategy for BLAS (Bottom-Level Acceleration Structure) scratch buffers in ray tracing for skinned geometry.
This setting variable is primarily used in the ray tracing subsystem of Unreal Engine, specifically for handling skinned geometry. It’s part of the rendering system, focusing on optimizing memory usage for ray tracing operations.
The value of this variable is set through the Unreal Engine console variable system. It’s defined as an FAutoConsoleVariableRef, which allows it to be modified at runtime through console commands or configuration files.
The associated variable GRayTracingUseTransientForScratch directly interacts with r.SkinCache.RayTracingUseTransientForScratch. They share the same value, with GRayTracingUseTransientForScratch being the actual integer variable used in the code logic.
Developers should be aware that this variable affects memory allocation strategies. When enabled (set to a value greater than 0), it uses transient memory for BLAS scratch allocation. This can potentially reduce memory footprint and allocation overhead, which is particularly important for performance-sensitive ray tracing operations.
Best practices when using this variable include:
- Testing performance with and without transient memory allocation to determine the optimal setting for your specific use case.
- Monitoring memory usage and performance metrics when adjusting this setting.
- Considering the trade-offs between memory footprint and potential allocation overhead.
Regarding the associated variable GRayTracingUseTransientForScratch:
- Its purpose is to serve as the actual integer value that the code logic checks to determine whether to use transient memory for BLAS scratch allocation.
- It’s used within the FRayTracingSkinnedGeometryUpdateQueue::ComputeScratchBufferSize() function to calculate the scratch buffer size when transient memory is enabled.
- The value is set by the console variable system, mirroring r.SkinCache.RayTracingUseTransientForScratch.
- It directly controls the behavior of the scratch buffer size computation in ray tracing operations for skinned geometry.
- Developers should be aware that changing r.SkinCache.RayTracingUseTransientForScratch will affect this variable and, consequently, the memory allocation behavior for ray tracing operations.
- Best practices include using this variable in conjunction with performance profiling tools to optimize ray tracing performance and memory usage in your specific scenarios.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/RayTracingSkinnedGeometry.cpp:20
Scope: file
Source code excerpt:
static int32 GRayTracingUseTransientForScratch = 0;
FAutoConsoleVariableRef CVarSkinnedGeometryRayTracingUseTransientForScratch(
TEXT("r.SkinCache.RayTracingUseTransientForScratch"),
GRayTracingUseTransientForScratch,
TEXT("Use Transient memory for BLAS scratch allocation to reduce memory footprint and allocation overhead."),
ECVF_RenderThreadSafe
);
static int32 GMaxRayTracingPrimitivesPerCmdList = -1;
#Associated Variable and Callsites
This variable is associated with another variable named GRayTracingUseTransientForScratch
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/RayTracingSkinnedGeometry.cpp:18
Scope: file
Source code excerpt:
);
static int32 GRayTracingUseTransientForScratch = 0;
FAutoConsoleVariableRef CVarSkinnedGeometryRayTracingUseTransientForScratch(
TEXT("r.SkinCache.RayTracingUseTransientForScratch"),
GRayTracingUseTransientForScratch,
TEXT("Use Transient memory for BLAS scratch allocation to reduce memory footprint and allocation overhead."),
ECVF_RenderThreadSafe
);
static int32 GMaxRayTracingPrimitivesPerCmdList = -1;
FAutoConsoleVariableRef CVarSkinnedGeometryMaxRayTracingPrimitivesPerCmdList(
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/RayTracingSkinnedGeometry.cpp:72
Scope (from outer to inner):
file
function uint32 FRayTracingSkinnedGeometryUpdateQueue::ComputeScratchBufferSize
Source code excerpt:
uint32 ScratchBLASSize = 0;
if (ToUpdate.Num() && GRayTracingUseTransientForScratch > 0)
{
for (TMap<FRayTracingGeometry*, FRayTracingUpdateInfo>::TRangedForConstIterator Iter = ToUpdate.begin(); Iter != ToUpdate.end(); ++Iter)
{
FRayTracingUpdateInfo const& UpdateInfo = Iter.Value();
ScratchBLASSize = Align(ScratchBLASSize + UpdateInfo.ScratchSize, ScratchAlignment);
}