r.TextureProfiler.MinRenderTargetSizeMB
r.TextureProfiler.MinRenderTargetSizeMB
#Overview
name: r.TextureProfiler.MinRenderTargetSizeMB
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
The minimum combined size for render targets to be reported. All combined sizes less than this threshold will be reported as Other.
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.TextureProfiler.MinRenderTargetSizeMB is to set a minimum size threshold for reporting render targets in the texture profiler. It is used in the rendering system, specifically for texture profiling and memory management.
This setting variable is primarily used in the RHI (Rendering Hardware Interface) module of Unreal Engine 5, as evidenced by its location in the TextureProfiler.cpp file within the RHI Private directory.
The value of this variable is set through a console variable (CVarTextureProfilerMinRenderTargetSizeMB) with a default value of 0. This means that by default, all render targets will be reported individually.
This variable interacts closely with CVarTextureProfilerMinTextureSizeMB, which serves a similar purpose for regular textures. Both variables are used together in the texture profiling system to determine which textures and render targets should be reported individually and which should be grouped under “Other.”
Developers should be aware that this variable affects the granularity of texture profiling information. Setting a higher value will result in fewer individual render targets being reported, potentially making it harder to identify specific problematic render targets.
Best practices when using this variable include:
- Keep the value low (or at 0) during development to get detailed profiling information.
- Adjust the value based on the scale of your project and the typical sizes of your render targets.
- Use in conjunction with r.TextureProfiler.MinTextureSizeMB for consistent profiling across all texture types.
Regarding the associated variable CVarTextureProfilerMinRenderTargetSizeMB:
This is the actual console variable that controls the r.TextureProfiler.MinRenderTargetSizeMB setting. It is defined as an integer and is used to store the minimum size in megabytes. The variable is accessed in the FTextureProfiler::Update and FTextureProfiler::DumpTextures functions to determine which render targets should be reported individually and which should be grouped under “Other.”
When using this variable, developers should note that it’s queried using GetValueOnAnyThread(), which means its value can be changed at runtime through console commands. This allows for dynamic adjustment of profiling granularity without restarting the engine.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/RHI/Private/TextureProfiler.cpp:39
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarTextureProfilerMinRenderTargetSizeMB(
TEXT("r.TextureProfiler.MinRenderTargetSizeMB"),
0,
TEXT("The minimum combined size for render targets to be reported. All combined sizes less than this threshold will be reported as Other."));
static TAutoConsoleVariable<bool> CVarTextureProfilerEnableTextureCSV(
TEXT("r.TextureProfiler.EnableTextureCSV"),
true,
#Associated Variable and Callsites
This variable is associated with another variable named CVarTextureProfilerMinRenderTargetSizeMB
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/RHI/Private/TextureProfiler.cpp:38
Scope: file
Source code excerpt:
TEXT("The minimum size for any texture to be reported. All textures below this threshold will be reported as Other."));
static TAutoConsoleVariable<int32> CVarTextureProfilerMinRenderTargetSizeMB(
TEXT("r.TextureProfiler.MinRenderTargetSizeMB"),
0,
TEXT("The minimum combined size for render targets to be reported. All combined sizes less than this threshold will be reported as Other."));
static TAutoConsoleVariable<bool> CVarTextureProfilerEnableTextureCSV(
TEXT("r.TextureProfiler.EnableTextureCSV"),
#Loc: <Workspace>/Engine/Source/Runtime/RHI/Private/TextureProfiler.cpp:322
Scope (from outer to inner):
file
function void FTextureProfiler::Update
Source code excerpt:
size_t MinTextureSize = (size_t)CVarTextureProfilerMinTextureSizeMB.GetValueOnAnyThread() * 1024LL * 1024LL;
size_t MinRenderTargetSize = (size_t)CVarTextureProfilerMinRenderTargetSizeMB.GetValueOnAnyThread() * 1024LL * 1024LL;
// Keep track of all stats that have been added this round. the CVS trace profiler wants to know what stats have been added, but only once per frame
// Keep one set per category
struct ECategoryIndex
{
enum
#Loc: <Workspace>/Engine/Source/Runtime/RHI/Private/TextureProfiler.cpp:410
Scope (from outer to inner):
file
function void FTextureProfiler::DumpTextures
Source code excerpt:
size_t MinTextureSize = CVarTextureProfilerMinTextureSizeMB.GetValueOnAnyThread() * 1024 * 1024;
size_t MinRenderTargetSize = CVarTextureProfilerMinRenderTargetSizeMB.GetValueOnAnyThread() * 1024 * 1024;
size_t MinSize = RenderTargets ? MinRenderTargetSize : MinTextureSize;
const TMap<FName, FTextureDetails>& CombinedSizes = RenderTargets ? CombinedRenderTargetSizes : CombinedTextureSizes;
TArray<const FTextureDetails*> CombinedSizesSorted;