MinTextureResidentMipCount
MinTextureResidentMipCount
#Overview
name: MinTextureResidentMipCount
The value of this variable can be defined or overridden in .ini config files. 1
.ini config file referencing this setting variable.
It is referenced in 7
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of MinTextureResidentMipCount is to control the minimum number of mip levels that should remain resident in memory for textures in Unreal Engine 5. This setting is primarily used in the texture streaming system to manage memory usage and performance related to texture loading.
This setting variable is primarily relied upon by the Engine’s texture streaming subsystem and the Mutable plugin, which is an experimental plugin for runtime asset modification.
The value of this variable is set in multiple places:
- In the Engine’s initialization process (FSystemSettings::Initialize), it’s read from the GEngineIni configuration file under the [TextureStreaming] section.
- In the Mutable plugin, it’s set through the CompilerOptions::SetDataPackingStrategy function.
Other variables that interact with MinTextureResidentMipCount include:
- EmbeddedDataBytesLimit and PackagedDataBytesLimit in the Mutable plugin’s CompilerOptions.
- bSeparateImageMips, which controls the splitting of image data into mips for progressive textures.
Developers must be aware of the following when using this variable:
- It directly affects memory usage and texture streaming performance.
- Changing this value can impact the visual quality of distant objects or textures.
- In the Mutable plugin, it’s used during the compilation and linking process of mutable models.
Best practices when using this variable include:
- Carefully balance between memory usage and visual quality. A higher value will keep more mip levels in memory, potentially improving visual quality but increasing memory usage.
- Consider platform-specific requirements when setting this value, as mobile devices might benefit from a lower value to conserve memory.
- Test thoroughly after changing this value to ensure it doesn’t negatively impact performance or visual quality in your specific use case.
- When using the Mutable plugin, be mindful of how this value interacts with other compilation and linking options.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseEngine.ini:1810, section: [TextureStreaming]
- INI Section:
TextureStreaming
- Raw value:
7
- Is Array:
False
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Plugins/Experimental/Mutable/Source/MutableTools/Internal/MuT/AST.h:228
Scope (from outer to inner):
file
namespace mu
Source code excerpt:
// TODO: Unused?
int32 MinTextureResidentMipCount = 0;
/** This flag controls the splitting of image data into mips to store separately. It is usually necessary to
* be able to generate progressive textures (for texture streaming).
*/
bool bSeparateImageMips = true;
#Loc: <Workspace>/Engine/Plugins/Experimental/Mutable/Source/MutableTools/Private/MuT/CodeOptimiser.cpp:484
Scope (from outer to inner):
file
namespace mu
class class FConstantTask
function void Run
Source code excerpt:
// Don't generate mips during linking here.
FLinkerOptions LinkerOptions(ImOp);
LinkerOptions.MinTextureResidentMipCount = 255;
LinkerOptions.bSeparateImageMips = false;
TSharedPtr<const Model> model = MakeShared<Model>();
OP::ADDRESS at = ASTOp::FullLink(SourceCloned, model->GetPrivate()->m_program, &LinkerOptions);
FProgram::FState state;
#Loc: <Workspace>/Engine/Plugins/Experimental/Mutable/Source/MutableTools/Private/MuT/Compiler.cpp:146
Scope (from outer to inner):
file
namespace mu
function void CompilerOptions::SetDataPackingStrategy
Source code excerpt:
//---------------------------------------------------------------------------------------------
void CompilerOptions::SetDataPackingStrategy(int32 MinTextureResidentMipCount, uint64 EmbeddedDataBytesLimit, uint64 PackagedDataBytesLimit)
{
m_pD->EmbeddedDataBytesLimit = EmbeddedDataBytesLimit;
m_pD->PackagedDataBytesLimit = PackagedDataBytesLimit;
m_pD->MinTextureResidentMipCount = MinTextureResidentMipCount;
}
//---------------------------------------------------------------------------------------------
void CompilerOptions::SetEnableProgressiveImages(bool bEnabled)
{
#Loc: <Workspace>/Engine/Plugins/Experimental/Mutable/Source/MutableTools/Private/MuT/Compiler.cpp:338
Scope (from outer to inner):
file
namespace mu
function TSharedPtr<Model> Compiler::Compile
Source code excerpt:
for(FStateCompilationData& s: states )
{
LinkerOptions.MinTextureResidentMipCount = m_pD->m_options->GetPrivate()->MinTextureResidentMipCount;
if (s.root)
{
s.state.m_root = ASTOp::FullLink(s.root, program, &LinkerOptions);
}
else
#Loc: <Workspace>/Engine/Plugins/Experimental/Mutable/Source/MutableTools/Private/MuT/CompilerPrivate.h:27
Scope (from outer to inner):
file
namespace mu
class class CompilerOptions::Private
Source code excerpt:
// \TODO: Unused?
int32 MinTextureResidentMipCount = 3;
int32 ImageCompressionQuality = 0;
int32 ImageTiling = 0 ;
/** If this flag is enabled, the compiler can use concurrency to reduce compile time at the cost of higher CPU and memory usage. */
bool bUseConcurrency = false;
#Loc: <Workspace>/Engine/Plugins/Experimental/Mutable/Source/MutableTools/Public/MuT/Compiler.h:75
Scope (from outer to inner):
file
namespace mu
class class CompilerOptions : public RefCounted
Source code excerpt:
//!
void SetDataPackingStrategy( int32 MinTextureResidentMipCount, uint64 EmbeddedDataBytesLimit, uint64 PackagedDataBytesLimit);
/** If enabled it will make sure that the object is compile to generate smaller mips of the images. */
void SetEnableProgressiveImages(bool bEnabled);
/** Set an optional pixel conversion function that will be called before any pixel format conversion. */
void SetImagePixelFormatOverride(const FImageOperator::FImagePixelFormatFunc&);
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/SystemSettings.cpp:230
Scope (from outer to inner):
file
function void FSystemSettings::Initialize
Source code excerpt:
// initialize a critical texture streaming value used by texture loading, etc
int32 MinTextureResidentMipCount = 7;
GConfig->GetInt(TEXT("TextureStreaming"), TEXT("MinTextureResidentMipCount"), MinTextureResidentMipCount, GEngineIni);
UTexture2D::SetMinTextureResidentMipCount(MinTextureResidentMipCount);
}
void FSystemSettings::CVarSink()
{
ApplyOverrides();
}