vr.InstancedStereo
vr.InstancedStereo
#Overview
name: vr.InstancedStereo
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
0 to disable instanced stereo (default), 1 to enable.
It is referenced in 8
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of vr.InstancedStereo is to enable or disable instanced stereo rendering for virtual reality applications in Unreal Engine 5. This setting is part of the rendering system, specifically for stereoscopic rendering in VR.
The Unreal Engine subsystems that rely on this setting variable include:
- The Renderer module
- The PanoramicCapture plugin
- The nDisplay plugin
- The Engine module (ShaderCompiler)
- The RenderCore module
The value of this variable is set through the console variable system. It’s defined as a TAutoConsoleVariable with a default value of 0 (disabled). Users can change this value at runtime or through configuration files.
This variable interacts with other VR-related variables, particularly vr.MobileMultiView. These two variables are often checked together to determine the appropriate rendering method for VR.
Developers must be aware of the following when using this variable:
- Enabling instanced stereo (setting to 1) may not be supported on all platforms or in all rendering scenarios.
- It’s not compatible with certain features like panoramic capture.
- The nDisplay plugin doesn’t support instanced stereo.
- Changing this value may require shader recompilation.
Best practices when using this variable include:
- Ensure your target platforms support instanced stereo before enabling it.
- Test performance with both instanced stereo enabled and disabled to determine the best setting for your application.
- Be aware of potential conflicts with other VR rendering methods like Mobile Multi-View.
- Consider the implications on shader compilation and loading times when changing this setting.
Regarding the associated variable CVarInstancedStereo:
The purpose of CVarInstancedStereo is to provide a programmatic way to access and check the value of the vr.InstancedStereo setting within the engine’s C++ code. It’s essentially a cached reference to the console variable for more efficient access.
This variable is used in various parts of the engine, including the shader compiler and stereo rendering utilities. It allows the engine to quickly check if instanced stereo is enabled without having to query the console variable system each time.
Developers should be aware that CVarInstancedStereo is typically used internally by the engine, and they should generally interact with the vr.InstancedStereo setting rather than this variable directly. However, understanding its usage can be helpful when debugging or extending VR-related functionality in the engine.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneRendering.cpp:212
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarInstancedStereo(
TEXT("vr.InstancedStereo"),
0,
TEXT("0 to disable instanced stereo (default), 1 to enable."),
ECVF_ReadOnly | ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarMobileMultiView(
TEXT("vr.MobileMultiView"),
#Loc: <Workspace>/Engine/Plugins/Experimental/PanoramicCapture/Source/PanoramicCapture/Private/StereoPanoramaManager.cpp:53
Scope (from outer to inner):
file
function bool FStereoPanoramaManager::ValidateRendererState
Source code excerpt:
bool FStereoPanoramaManager::ValidateRendererState() const
{
static const auto InstancedStereoCVar = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("vr.InstancedStereo"));
const bool bIsInstancedStereoEnabled = (InstancedStereoCVar && InstancedStereoCVar->GetValueOnAnyThread() != 0);
if (bIsInstancedStereoEnabled)
{
FMessageLog(StereoPanoramaLogName).Message(EMessageSeverity::Error, LOCTEXT("ValidateRendererState", "Panoramic capture not supported with instanced stereo rendering enabled."));
return false;
#Loc: <Workspace>/Engine/Plugins/Runtime/nDisplay/Source/DisplayCluster/Private/Game/EngineClasses/Scene/DisplayClusterRootActor.cpp:1045
Scope (from outer to inner):
file
function void ADisplayClusterRootActor::Tick
Source code excerpt:
if (OperationMode != EDisplayClusterOperationMode::Disabled && bIsPrimaryRootActor)
{
static const TConsoleVariableData<int32>* const InstancedStereoCVar = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("vr.InstancedStereo"));
if (InstancedStereoCVar)
{
const bool bIsInstancedStereoRequested = (InstancedStereoCVar->GetValueOnGameThread() != 0);
if (bIsInstancedStereoRequested)
{
UE_LOG(LogDisplayClusterGame, Error, TEXT("Instanced stereo was requested. nDisplay doesn't support instanced stereo so far."));
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/ShaderCompiler/ShaderCompiler.cpp:8027
Scope (from outer to inner):
file
function void GlobalBeginCompileShader
Source code excerpt:
// Throw a warning if we are silently disabling ISR due to missing platform support (but don't have MMV enabled).
static const auto CVarInstancedStereo = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("vr.InstancedStereo"));
const bool bIsInstancedStereoEnabledInSettings = CVarInstancedStereo ? (CVarInstancedStereo->GetValueOnAnyThread() != 0) : false;
static const auto CVarMultiview = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("vr.MobileMultiView"));
const bool bIsMultiviewEnabledInSettings = CVarMultiview ? (CVarMultiview->GetValueOnAnyThread() != 0) : false;
bool bWarningIssued = false;
// warn if ISR was enabled in settings, but aspects show that it's not enabled AND we don't use Mobile MultiView as an alternative
if (bIsInstancedStereoEnabledInSettings && !Aspects.IsInstancedStereoEnabled() && !(bIsMultiviewEnabledInSettings && Aspects.IsMobileMultiViewEnabled()) && !GShaderCompilingManager->AreWarningsSuppressed(ShaderPlatform))
#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/StereoRenderUtils.cpp:55
Scope (from outer to inner):
file
namespace UE::StereoRenderUtils
function FStereoShaderAspects::FStereoShaderAspects
Source code excerpt:
// Would be nice to use URendererSettings, but not accessible in RenderCore
static FShaderPlatformCachedIniValue<bool> CVarInstancedStereo(TEXT("vr.InstancedStereo"));
static FShaderPlatformCachedIniValue<bool> CVarMobileMultiView(TEXT("vr.MobileMultiView"));
const bool bInstancedStereo = CVarInstancedStereo.Get(Platform);
const bool bMobilePlatform = IsMobilePlatform(Platform);
const bool bMobilePostprocessing = IsMobileHDR();
#Associated Variable and Callsites
This variable is associated with another variable named CVarInstancedStereo
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/ShaderCompiler/ShaderCompiler.cpp:8027
Scope (from outer to inner):
file
function void GlobalBeginCompileShader
Source code excerpt:
// Throw a warning if we are silently disabling ISR due to missing platform support (but don't have MMV enabled).
static const auto CVarInstancedStereo = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("vr.InstancedStereo"));
const bool bIsInstancedStereoEnabledInSettings = CVarInstancedStereo ? (CVarInstancedStereo->GetValueOnAnyThread() != 0) : false;
static const auto CVarMultiview = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("vr.MobileMultiView"));
const bool bIsMultiviewEnabledInSettings = CVarMultiview ? (CVarMultiview->GetValueOnAnyThread() != 0) : false;
bool bWarningIssued = false;
// warn if ISR was enabled in settings, but aspects show that it's not enabled AND we don't use Mobile MultiView as an alternative
if (bIsInstancedStereoEnabledInSettings && !Aspects.IsInstancedStereoEnabled() && !(bIsMultiviewEnabledInSettings && Aspects.IsMobileMultiViewEnabled()) && !GShaderCompilingManager->AreWarningsSuppressed(ShaderPlatform))
{
#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/StereoRenderUtils.cpp:55
Scope (from outer to inner):
file
namespace UE::StereoRenderUtils
function FStereoShaderAspects::FStereoShaderAspects
Source code excerpt:
// Would be nice to use URendererSettings, but not accessible in RenderCore
static FShaderPlatformCachedIniValue<bool> CVarInstancedStereo(TEXT("vr.InstancedStereo"));
static FShaderPlatformCachedIniValue<bool> CVarMobileMultiView(TEXT("vr.MobileMultiView"));
const bool bInstancedStereo = CVarInstancedStereo.Get(Platform);
const bool bMobilePlatform = IsMobilePlatform(Platform);
const bool bMobilePostprocessing = IsMobileHDR();
const bool bMobileMultiView = CVarMobileMultiView.Get(Platform);
// If we're in a non-rendering run (cooker, DDC commandlet, anything with -nullrhi), don't check GRHI* setting, as it reflects runtime RHI capabilities.
const bool bMultiViewportCapable = (GRHISupportsArrayIndexFromAnyShader || !FApp::CanEverRender()) && RHISupportsMultiViewport(Platform);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneRendering.cpp:211
Scope: file
Source code excerpt:
ECVF_Scalability | ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarInstancedStereo(
TEXT("vr.InstancedStereo"),
0,
TEXT("0 to disable instanced stereo (default), 1 to enable."),
ECVF_ReadOnly | ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarMobileMultiView(