r.Mobile.VirtualTextures
r.Mobile.VirtualTextures
#Overview
name: r.Mobile.VirtualTextures
The value of this variable can be defined or overridden in .ini config files. 1
.ini config file referencing this setting variable.
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Whether virtual texture streaming is enabled on mobile platforms. Requires r.VirtualTextures enabled as well. \n
It is referenced in 10
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Mobile.VirtualTextures
is to control whether virtual texture streaming is enabled on mobile platforms in Unreal Engine 5. This setting is specifically related to the rendering system, particularly for mobile devices.
The Unreal Engine subsystems that rely on this setting variable are primarily the rendering system and the texture streaming system. It’s used in the MetalRHI module for Apple platforms, the AndroidTargetPlatformSettings, IOSTargetPlatform, and the general RenderCore module.
The value of this variable is set in the engine configuration file (GEngineIni) under the “/Script/Engine.RendererSettings” section. It can also be controlled via console commands due to its implementation as a console variable (CVarMobileVirtualTextures).
This variable interacts with other rendering-related variables, particularly r.VirtualTextures
. The mobile virtual textures feature requires r.VirtualTextures
to be enabled as well.
Developers must be aware that:
- This feature is platform-specific and mainly targets mobile devices.
- It requires a minimum hardware capability (e.g., Apple A9 feature set for iOS devices).
- Enabling this feature may have performance implications, so it should be tested thoroughly on target devices.
Best practices when using this variable include:
- Ensure that the target mobile devices support virtual texturing.
- Always test the performance impact when enabling this feature.
- Use in conjunction with
r.VirtualTextures
for proper functionality. - Consider the memory and performance trade-offs of using virtual textures on mobile platforms.
Regarding the associated variable CVarMobileVirtualTextures
:
The purpose of CVarMobileVirtualTextures
is to provide programmatic access to the r.Mobile.VirtualTextures
setting within the engine’s C++ code. It’s used to check the current state of the mobile virtual textures feature at runtime.
This console variable is used in the MetalRHI module to check if mobile virtual textures are enabled and log a warning if the hardware doesn’t meet the minimum requirements. It’s also used in the texture-related code to control behavior based on whether mobile virtual textures are enabled.
The value of CVarMobileVirtualTextures
is set based on the r.Mobile.VirtualTextures
configuration setting.
Developers should be aware that CVarMobileVirtualTextures
provides a way to access the mobile virtual textures setting in C++ code, which can be useful for conditional logic based on whether this feature is enabled.
Best practices for using CVarMobileVirtualTextures
include:
- Use it for runtime checks of the mobile virtual textures feature state.
- Be aware that changes to this variable at runtime may not immediately affect all systems that rely on it.
- Consider performance implications when frequently querying this variable’s value.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseDeviceProfiles.ini:708, section: [VisionProSimulator DeviceProfile]
- INI Section:
VisionProSimulator DeviceProfile
- Raw value:
0
- Is Array:
False
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Texture.cpp:61
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarMobileVirtualTextures(
TEXT("r.Mobile.VirtualTextures"),
0,
TEXT("Whether virtual texture streaming is enabled on mobile platforms. Requires r.VirtualTextures enabled as well. \n"),
ECVF_RenderThreadSafe | ECVF_ReadOnly
);
static TAutoConsoleVariable<int32> CVarVirtualTexturesAutoImport(
#Loc: <Workspace>/Engine/Source/Developer/Android/AndroidTargetPlatformSettings/Private/AndroidTargetPlatformSettings.cpp:20
Scope (from outer to inner):
file
function FAndroidTargetPlatformSettings::FAndroidTargetPlatformSettings
Source code excerpt:
GetConfigSystem()->GetInt(TEXT("/Script/Engine.RendererSettings"), TEXT("r.Mobile.ShadingPath"), MobileShadingPath, GEngineIni);
GetConfigSystem()->GetBool(TEXT("/Script/Engine.RendererSettings"), TEXT("r.Mobile.Forward.EnableClusteredReflections"), bMobileForwardEnableClusteredReflections, GEngineIni);
GetConfigSystem()->GetBool(TEXT("/Script/Engine.RendererSettings"), TEXT("r.Mobile.VirtualTextures"), bMobileVirtualTextures, GEngineIni);
#endif
}
bool FAndroidTargetPlatformSettings::SupportsES31() const
{
// default no support for ES31
#Loc: <Workspace>/Engine/Source/Developer/Android/AndroidTargetPlatformSettings/Public/AndroidTargetPlatformSettings.h:145
Scope (from outer to inner):
file
function class ANDROIDTARGETPLATFORMSETTINGS_API FAndroidTargetPlatformSettings : public TTargetPlatformSettingsBase<FAndroidPlatformProperties> { public: FAndroidTargetPlatformSettings
Source code excerpt:
bool bMobileForwardEnableClusteredReflections;
// r.Mobile.VirtualTextures value
bool bMobileVirtualTextures;
#if WITH_ENGINE
// Holds a cache of the target LOD settings.
const UTextureLODSettings* TextureLODSettings;
// Holds the static mesh LOD settings.
#Loc: <Workspace>/Engine/Source/Developer/IOS/IOSTargetPlatform/Private/IOSTargetPlatform.cpp:44
Scope (from outer to inner):
file
function FIOSTargetPlatform::FIOSTargetPlatform
Source code excerpt:
GetConfigSystem()->GetInt(TEXT("/Script/Engine.RendererSettings"), TEXT("r.Mobile.ShadingPath"), MobileShadingPath, GEngineIni);
GetConfigSystem()->GetBool(TEXT("/Script/Engine.RendererSettings"), TEXT("r.Mobile.Forward.EnableClusteredReflections"), bMobileForwardEnableClusteredReflections, GEngineIni);
GetConfigSystem()->GetBool(TEXT("/Script/Engine.RendererSettings"), TEXT("r.Mobile.VirtualTextures"), bMobileVirtualTextures, GEngineIni);
#endif // #if WITH_ENGINE
// initialize the connected device detector
DeviceHelper.OnDeviceConnected().AddRaw(this, &FIOSTargetPlatform::HandleDeviceConnected);
DeviceHelper.OnDeviceDisconnected().AddRaw(this, &FIOSTargetPlatform::HandleDeviceDisconnected);
DeviceHelper.Initialize(bIsTVOS || bIsVisionOS);
#Loc: <Workspace>/Engine/Source/Developer/IOS/IOSTargetPlatform/Private/IOSTargetPlatform.h:142
Scope (from outer to inner):
file
class class FIOSTargetPlatform : public TNonDesktopTargetPlatformBase<FIOSPlatformProperties>
Source code excerpt:
bool bMobileForwardEnableClusteredReflections;
// r.Mobile.VirtualTextures value
bool bMobileVirtualTextures;
#if WITH_ENGINE
// Holds the cache of the target LOD settings.
const UTextureLODSettings* TextureLODSettings;
#Loc: <Workspace>/Engine/Source/Runtime/Apple/MetalRHI/Private/MetalRHI.cpp:249
Scope: file
Source code excerpt:
}
static auto* CVarMobileVirtualTextures = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.Mobile.VirtualTextures"));
if(CVarMobileVirtualTextures->GetValueOnAnyThread() != 0)
{
UE_LOG(LogMetal, Warning, TEXT("Mobile Virtual Textures require a minimum of the Apple A9 feature set."));
}
}
#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/RenderUtils.cpp:1150
Scope (from outer to inner):
file
function bool UseVirtualTexturing
Source code excerpt:
#endif
{
static FShaderPlatformCachedIniValue<bool> MobileVirtualTexturesIniValue(TEXT("r.Mobile.VirtualTextures"));
return (MobileVirtualTexturesIniValue.Get(ShaderPlatform) != false);
}
}
return true;
#else
return false;
#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/Shader.cpp:2190
Scope (from outer to inner):
file
function void ShaderMapAppendKeyString
Source code excerpt:
if (IsMobilePlatform(Platform) && VTTextures)
{
static FShaderPlatformCachedIniValue<bool> MobileVirtualTexturesIniValue(TEXT("r.Mobile.VirtualTextures"));
VTTextures = (MobileVirtualTexturesIniValue.Get(Platform) != false);
if (VTTextures)
{
static FShaderPlatformCachedIniValue<bool> CVarVTMobileManualTrilinearFiltering(TEXT("r.VT.Mobile.ManualTrilinearFiltering"));
VTFiltering += (CVarVTMobileManualTrilinearFiltering.Get(Platform) ? 2 : 0);
#Associated Variable and Callsites
This variable is associated with another variable named CVarMobileVirtualTextures
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Apple/MetalRHI/Private/MetalRHI.cpp:249
Scope: file
Source code excerpt:
}
static auto* CVarMobileVirtualTextures = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.Mobile.VirtualTextures"));
if(CVarMobileVirtualTextures->GetValueOnAnyThread() != 0)
{
UE_LOG(LogMetal, Warning, TEXT("Mobile Virtual Textures require a minimum of the Apple A9 feature set."));
}
}
bool bProjectSupportsMRTs = false;
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Texture.cpp:60
Scope: file
Source code excerpt:
ECVF_RenderThreadSafe | ECVF_ReadOnly);
static TAutoConsoleVariable<int32> CVarMobileVirtualTextures(
TEXT("r.Mobile.VirtualTextures"),
0,
TEXT("Whether virtual texture streaming is enabled on mobile platforms. Requires r.VirtualTextures enabled as well. \n"),
ECVF_RenderThreadSafe | ECVF_ReadOnly
);