r.Streaming.DropMips
r.Streaming.DropMips
#Overview
name: r.Streaming.DropMips
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
0: Drop No Mips \n1: Drop Cached Mips\n2: Drop Cached and Hidden Mips\n3: Drop cached mips and non-inlined LODs of no-ref meshes
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Streaming.DropMips is to control the level of mip-map dropping in the texture streaming system. This setting variable is part of Unreal Engine’s rendering and streaming subsystems, specifically targeting texture and mesh LOD management.
The Unreal Engine subsystems that rely on this setting variable are primarily the texture streaming and rendering modules. This can be seen from the file locations where the variable is referenced: Engine/Source/Runtime/Engine/Private/Streaming/TextureStreamingHelpers.cpp and Engine/Source/Runtime/Engine/Private/Streaming/AsyncTextureStreaming.cpp.
The value of this variable is set through a console variable (CVarStreamingDropMips) with four possible options: 0: Drop No Mips 1: Drop Cached Mips 2: Drop Cached and Hidden Mips 3: Drop cached mips and non-inlined LODs of no-ref meshes
This variable interacts with the FRenderAssetStreamingSettings struct, where its value is stored in the DropMips member variable.
Developers must be aware that this variable can significantly impact rendering performance and memory usage. It’s primarily intended for testing and optimization purposes, as indicated by the ECVF_Cheat flag in its declaration.
Best practices when using this variable include:
- Use it cautiously, as it can affect visual quality and performance.
- Consider using it in conjunction with other streaming and rendering settings for comprehensive testing.
- Be aware that setting higher values (2 or 3) may cause more aggressive mip-map dropping, which could lead to visual artifacts but potentially improve performance.
Regarding the associated variable CVarStreamingDropMips, it is the actual console variable that controls the r.Streaming.DropMips setting. It’s defined using TAutoConsoleVariable, which allows it to be changed at runtime through console commands. The usage and implications of CVarStreamingDropMips are the same as those described for r.Streaming.DropMips, as they represent the same setting in different contexts within the engine code.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Streaming/TextureStreamingHelpers.cpp:127
Scope: file
Source code excerpt:
TAutoConsoleVariable<int32> CVarStreamingDropMips(
TEXT("r.Streaming.DropMips"),
0,
TEXT("0: Drop No Mips \n")
TEXT("1: Drop Cached Mips\n")
TEXT("2: Drop Cached and Hidden Mips\n")
TEXT("3: Drop cached mips and non-inlined LODs of no-ref meshes"),
ECVF_Cheat);
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Streaming/AsyncTextureStreaming.cpp:125
Scope (from outer to inner):
file
function void FAsyncRenderAssetStreamingData::UpdatePerfectWantedMips_Async
Source code excerpt:
if (Settings.bStressTest)
{
// In stress test, we choose between the allowed mips. Combined with "r.Streaming.DropMips=2" this can also generate cancel requests.
const int32 NumMips = FMath::RandRange(StreamingRenderAsset.MinAllowedMips, StreamingRenderAsset.MaxAllowedMips);
MaxSize_VisibleOnly = MaxSize = StreamingRenderAsset.GetLODScreenSize(NumMips, MaxScreenSizeOverAllViews);
}
else
#endif
if (Settings.bFullyLoadMeshes && StreamingRenderAsset.IsMesh())
#Associated Variable and Callsites
This variable is associated with another variable named CVarStreamingDropMips
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Streaming/TextureStreamingHelpers.cpp:126
Scope: file
Source code excerpt:
ECVF_Default);
TAutoConsoleVariable<int32> CVarStreamingDropMips(
TEXT("r.Streaming.DropMips"),
0,
TEXT("0: Drop No Mips \n")
TEXT("1: Drop Cached Mips\n")
TEXT("2: Drop Cached and Hidden Mips\n")
TEXT("3: Drop cached mips and non-inlined LODs of no-ref meshes"),
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Streaming/TextureStreamingHelpers.cpp:360
Scope (from outer to inner):
file
function void FRenderAssetStreamingSettings::Update
Source code excerpt:
bStressTest = false;
FramesForFullUpdate = FMath::Max<int32>(CVarFramesForFullUpdate.GetValueOnAnyThread(), 0);
DropMips = CVarStreamingDropMips.GetValueOnAnyThread();
ExtraIOLatency = 0;
}
}
/** the float table {-1.0f,1.0f} **/
float ENGINE_API GNegativeOneOneTable[2] = {-1.0f,1.0f};