r.OpenGL.DisableTextureStreamingSupport
r.OpenGL.DisableTextureStreamingSupport
#Overview
name: r.OpenGL.DisableTextureStreamingSupport
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Disable support for texture streaming on OpenGL.\n 0 = Texture streaming will be used if device supports it [default]\n 1 = Texture streaming will be disabled.
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.OpenGL.DisableTextureStreamingSupport is to control texture streaming support for OpenGL devices in Unreal Engine 5. It allows developers to disable texture streaming on OpenGL platforms if needed.
This setting variable is primarily used in the OpenGL rendering module of Unreal Engine. Specifically, it’s referenced in the OpenGLDrv module, which is responsible for handling OpenGL-specific rendering tasks.
The value of this variable is set through the console variable system. It’s defined as a TAutoConsoleVariable with a default value of 0, meaning texture streaming is enabled by default if the device supports it.
The variable interacts directly with the GRHISupportsTextureStreaming global variable. When r.OpenGL.DisableTextureStreamingSupport is set to 1, it forces GRHISupportsTextureStreaming to false, effectively disabling texture streaming for OpenGL devices.
Developers must be aware that this variable is marked as ECVF_ReadOnly, which means it can only be set at startup and cannot be changed during runtime. This is important for maintaining consistent rendering behavior throughout the application’s lifecycle.
Best practices when using this variable include:
- Only disable texture streaming if there are specific performance issues or compatibility problems with OpenGL devices.
- Test thoroughly on target OpenGL devices when changing this setting, as it can significantly impact rendering performance and memory usage.
- Consider the implications on texture quality and memory consumption when disabling texture streaming.
Regarding the associated variable CVarDisableOpenGLTextureStreamingSupport:
This is the actual console variable object that represents r.OpenGL.DisableTextureStreamingSupport in the code. It’s used to retrieve the current value of the setting and determine whether to disable texture streaming.
The purpose of CVarDisableOpenGLTextureStreamingSupport is to provide a programmatic interface to access the r.OpenGL.DisableTextureStreamingSupport setting within the engine code.
This variable is used in the OpenGLDrv module, specifically in the InitRHICapabilitiesForGL function, to initialize the rendering capabilities for OpenGL devices.
The value of CVarDisableOpenGLTextureStreamingSupport is set automatically by the console variable system based on the r.OpenGL.DisableTextureStreamingSupport setting.
It interacts directly with the GRHISupportsTextureStreaming global variable, controlling whether texture streaming is supported for OpenGL devices.
Developers should be aware that this variable is accessed using IConsoleManager::Get().FindTConsoleVariableDataInt(), which returns a pointer to the console variable data. Always check for null before using this pointer.
Best practices for using CVarDisableOpenGLTextureStreamingSupport include:
- Use GetValueOnAnyThread() to safely retrieve the current value in a thread-safe manner.
- Consider caching the pointer to the console variable if it’s accessed frequently, to avoid repeated lookups.
- Remember that changes to this variable will only take effect during the initialization of OpenGL capabilities, so runtime changes may not have an immediate effect.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Core/Private/HAL/ConsoleManager.cpp:4175
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarDisableOpenGLTextureStreamingSupport(
TEXT("r.OpenGL.DisableTextureStreamingSupport"),
0,
TEXT("Disable support for texture streaming on OpenGL.\n"
" 0 = Texture streaming will be used if device supports it [default]\n"
" 1 = Texture streaming will be disabled."),
ECVF_ReadOnly);
#Loc: <Workspace>/Engine/Source/Runtime/OpenGLDrv/Private/OpenGLDevice.cpp:1136
Scope (from outer to inner):
file
function static void InitRHICapabilitiesForGL
Source code excerpt:
GRHISupportsTextureStreaming = true;
// Disable texture streaming if forced off by r.OpenGL.DisableTextureStreamingSupport
static const auto CVarDisableOpenGLTextureStreamingSupport = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.OpenGL.DisableTextureStreamingSupport"));
if (CVarDisableOpenGLTextureStreamingSupport->GetValueOnAnyThread())
{
GRHISupportsTextureStreaming = false;
}
for (int32 PF = 0; PF < PF_MAX; ++PF)
#Associated Variable and Callsites
This variable is associated with another variable named CVarDisableOpenGLTextureStreamingSupport
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Core/Private/HAL/ConsoleManager.cpp:4174
Scope: file
Source code excerpt:
ECVF_ReadOnly);
static TAutoConsoleVariable<int32> CVarDisableOpenGLTextureStreamingSupport(
TEXT("r.OpenGL.DisableTextureStreamingSupport"),
0,
TEXT("Disable support for texture streaming on OpenGL.\n"
" 0 = Texture streaming will be used if device supports it [default]\n"
" 1 = Texture streaming will be disabled."),
ECVF_ReadOnly);
#Loc: <Workspace>/Engine/Source/Runtime/OpenGLDrv/Private/OpenGLDevice.cpp:1137
Scope (from outer to inner):
file
function static void InitRHICapabilitiesForGL
Source code excerpt:
// Disable texture streaming if forced off by r.OpenGL.DisableTextureStreamingSupport
static const auto CVarDisableOpenGLTextureStreamingSupport = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.OpenGL.DisableTextureStreamingSupport"));
if (CVarDisableOpenGLTextureStreamingSupport->GetValueOnAnyThread())
{
GRHISupportsTextureStreaming = false;
}
for (int32 PF = 0; PF < PF_MAX; ++PF)
{