r.OIT.SortedTriangles.Pool.ReleaseFrameThreshold
r.OIT.SortedTriangles.Pool.ReleaseFrameThreshold
#Overview
name: r.OIT.SortedTriangles.Pool.ReleaseFrameThreshold
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Number of frame after which unused buffer are released.
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.OIT.SortedTriangles.Pool.ReleaseFrameThreshold is to control the release of unused buffers in the Order-Independent Transparency (OIT) system of Unreal Engine 5’s rendering pipeline. Specifically, it sets the number of frames after which unused sorted triangle buffers are released from memory.
This setting variable is primarily used by the OIT subsystem within the Renderer module of Unreal Engine 5. It’s part of the engine’s advanced rendering features, particularly for managing memory usage in scenarios involving transparent objects.
The value of this variable is set through a console variable (CVar) system, allowing it to be adjusted at runtime. It’s initialized with a default value of 100 frames.
The associated variable CVarOIT_SortedTriangles_PoolReleaseThreshold directly interacts with r.OIT.SortedTriangles.Pool.ReleaseFrameThreshold, as they represent the same setting in different contexts within the engine.
Developers should be aware that:
- This variable affects memory management for OIT rendering.
- Setting it too low might cause frequent allocation/deallocation of buffers, potentially impacting performance.
- Setting it too high might lead to unnecessary memory usage if there are many unused buffers.
Best practices when using this variable include:
- Adjusting it based on the specific needs of your project and target hardware capabilities.
- Monitoring performance and memory usage when modifying this value.
- Consider the frequency of transparent object changes in your scenes when setting this value.
Regarding the associated variable CVarOIT_SortedTriangles_PoolReleaseThreshold:
- It’s the internal representation of the console variable within the engine’s code.
- It’s used in the TrimSortedIndexBuffers function to determine when to release unused buffers.
- It’s checked in combination with another variable (CVarOIT_SortedTriangles_Pool) to determine if buffer trimming should occur.
Developers should treat CVarOIT_SortedTriangles_PoolReleaseThreshold as the programmatic interface to the r.OIT.SortedTriangles.Pool.ReleaseFrameThreshold setting, using it when they need to access or modify this value within C++ code.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/OIT/OIT.cpp:39
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarOIT_SortedTriangles_PoolReleaseThreshold(
TEXT("r.OIT.SortedTriangles.Pool.ReleaseFrameThreshold"),
100,
TEXT("Number of frame after which unused buffer are released."),
ECVF_RenderThreadSafe);
///////////////////////////////////////////////////////////////////////////////////////////////////
// Variables: sorted pixels
#Associated Variable and Callsites
This variable is associated with another variable named CVarOIT_SortedTriangles_PoolReleaseThreshold
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/OIT/OIT.cpp:38
Scope: file
Source code excerpt:
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarOIT_SortedTriangles_PoolReleaseThreshold(
TEXT("r.OIT.SortedTriangles.Pool.ReleaseFrameThreshold"),
100,
TEXT("Number of frame after which unused buffer are released."),
ECVF_RenderThreadSafe);
///////////////////////////////////////////////////////////////////////////////////////////////////
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/OIT/OIT.cpp:303
Scope (from outer to inner):
file
function static void TrimSortedIndexBuffers
Source code excerpt:
{
const int32 ElapsedFrame = FMath::Abs(int32(FrameId) - int32(LastFrameId));
if (ElapsedFrame > CVarOIT_SortedTriangles_PoolReleaseThreshold.GetValueOnRenderThread())
{
DeleteQueue.Enqueue(FreeBuffers[FreeIt]);
FreeBuffers[FreeIt] = FreeBuffers[FreeCount - 1];
--FreeCount;
FreeBuffers.SetNum(FreeCount);
continue;
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/OIT/OIT.cpp:907
Scope (from outer to inner):
file
class class FOITSortTriangleIndex_WriteOutCS : public FGlobalShader
Source code excerpt:
// Trim unused buffers
OITSceneData.FrameIndex = View.Family->FrameNumber;
if (CVarOIT_SortedTriangles_Pool.GetValueOnRenderThread() > 0 && CVarOIT_SortedTriangles_PoolReleaseThreshold.GetValueOnRenderThread() > 0)
{
TrimSortedIndexBuffers(OITSceneData.FreeBuffers, OITSceneData.PendingDeletes, OITSceneData.FrameIndex);
}
}
FOITData CreateOITData(FRDGBuilder& GraphBuilder, const FViewInfo& View, EOITPassType PassType)