r.GeometryCollectionTripleBufferUploads
r.GeometryCollectionTripleBufferUploads
#Overview
name: r.GeometryCollectionTripleBufferUploads
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Whether to triple buffer geometry collection uploads, which allows Lock_NoOverwrite uploads which are much faster on the GPU with large amounts of data.
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.GeometryCollectionTripleBufferUploads is to control whether triple buffering is used for geometry collection uploads in Unreal Engine 5. This setting is primarily used in the rendering system, specifically for optimizing the performance of geometry collections.
This setting variable is relied upon by the Experimental GeometryCollectionEngine module, which is part of Unreal Engine’s rendering subsystem. It’s used in the GeometryCollectionSceneProxy class, which is responsible for managing the rendering of geometry collections.
The value of this variable is set through the console variable system in Unreal Engine. It’s initialized with a default value of 1 (enabled) but can be changed at runtime.
The associated variable GGeometryCollectionTripleBufferUploads interacts directly with r.GeometryCollectionTripleBufferUploads. They share the same value, with GGeometryCollectionTripleBufferUploads being the actual integer used in the code logic.
Developers must be aware that this variable affects the performance of geometry collection rendering, especially when dealing with large amounts of data. When enabled (set to 1), it allows for Lock_NoOverwrite uploads, which can be significantly faster on the GPU when handling large data sets.
Best practices when using this variable include:
- Keep it enabled (default value of 1) for better performance with large geometry collections.
- If experiencing issues with geometry collection rendering, try disabling it (set to 0) to see if it resolves the problem.
- Profile your application with both settings to determine the optimal configuration for your specific use case.
Regarding the associated variable GGeometryCollectionTripleBufferUploads:
The purpose of GGeometryCollectionTripleBufferUploads is to provide a C++ accessible integer that reflects the state of the r.GeometryCollectionTripleBufferUploads console variable.
This variable is used directly in the code logic of the GeometryCollectionSceneProxy class to determine whether to use triple buffering for uploads.
The value of this variable is set by the console variable system when r.GeometryCollectionTripleBufferUploads is modified.
It interacts with the bSupportsTripleBufferVertexUpload variable to determine the final state of triple buffering for a specific instance.
Developers should be aware that this variable is used in conditional statements to control the behavior of the upload process. Its value (0 or non-zero) determines whether triple buffering is used.
Best practices for using this variable include:
- Do not modify it directly in code; instead, use the console variable r.GeometryCollectionTripleBufferUploads to change its value.
- When reading its value in code, consider combining it with other relevant conditions (like bSupportsTripleBufferVertexUpload) to make the final decision on using triple buffering.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/GeometryCollectionEngine/Private/GeometryCollection/GeometryCollectionSceneProxy.cpp:62
Scope: file
Source code excerpt:
static int32 GGeometryCollectionTripleBufferUploads = 1;
FAutoConsoleVariableRef CVarGeometryCollectionTripleBufferUploads(
TEXT("r.GeometryCollectionTripleBufferUploads"),
GGeometryCollectionTripleBufferUploads,
TEXT("Whether to triple buffer geometry collection uploads, which allows Lock_NoOverwrite uploads which are much faster on the GPU with large amounts of data."),
ECVF_Default
);
static int32 GRayTracingGeometryCollectionProxyMeshes = 0;
#Associated Variable and Callsites
This variable is associated with another variable named GGeometryCollectionTripleBufferUploads
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/GeometryCollectionEngine/Private/GeometryCollection/GeometryCollectionSceneProxy.cpp:60
Scope: file
Source code excerpt:
);
static int32 GGeometryCollectionTripleBufferUploads = 1;
FAutoConsoleVariableRef CVarGeometryCollectionTripleBufferUploads(
TEXT("r.GeometryCollectionTripleBufferUploads"),
GGeometryCollectionTripleBufferUploads,
TEXT("Whether to triple buffer geometry collection uploads, which allows Lock_NoOverwrite uploads which are much faster on the GPU with large amounts of data."),
ECVF_Default
);
static int32 GRayTracingGeometryCollectionProxyMeshes = 0;
FAutoConsoleVariableRef CVarRayTracingGeometryCollectionProxyMeshes(
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/GeometryCollectionEngine/Private/GeometryCollection/GeometryCollectionSceneProxy.cpp:298
Scope (from outer to inner):
file
function void FGeometryCollectionSceneProxy::CreateRenderThreadResources
Source code excerpt:
PrevTransformBuffers[0].InitResource(RHICmdList);
const bool bLocalGeometryCollectionTripleBufferUploads = (GGeometryCollectionTripleBufferUploads != 0) && bSupportsTripleBufferVertexUpload;
const EResourceLockMode LockMode = bLocalGeometryCollectionTripleBufferUploads ? RLM_WriteOnly_NoOverwrite : RLM_WriteOnly;
FGeometryCollectionTransformBuffer& TransformBuffer = GetCurrentTransformBuffer();
TransformBuffer.UpdateDynamicData(RHICmdList, RestTransforms, LockMode);
FGeometryCollectionTransformBuffer& PrevTransformBuffer = GetCurrentPrevTransformBuffer();
PrevTransformBuffer.UpdateDynamicData(RHICmdList, RestTransforms, LockMode);
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/GeometryCollectionEngine/Private/GeometryCollection/GeometryCollectionSceneProxy.cpp:431
Scope (from outer to inner):
file
function void FGeometryCollectionSceneProxy::SetDynamicData_RenderThread
Source code excerpt:
if (bSupportsManualVertexFetch)
{
const bool bLocalGeometryCollectionTripleBufferUploads = (GGeometryCollectionTripleBufferUploads != 0) && bSupportsTripleBufferVertexUpload;
if (bLocalGeometryCollectionTripleBufferUploads && TransformBuffers.Num() == 1)
{
TransformBuffers.AddDefaulted(2);
PrevTransformBuffers.AddDefaulted(2);