vr.MobileMultiView
vr.MobileMultiView
#Overview
name: vr.MobileMultiView
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
0 to disable mobile multi-view, 1 to enable.\n
It is referenced in 10
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of vr.MobileMultiView is to enable or disable mobile multi-view rendering for virtual reality applications on mobile platforms.
This setting variable is primarily used by the rendering system, specifically for mobile VR rendering. It is relied upon by several Unreal Engine subsystems and modules, including:
- The OpenGL rendering subsystem
- The mobile shading renderer
- The stereo rendering utilities
- The scene rendering system
The value of this variable is set through the console variable system, with a default value of 0 (disabled). It can be changed at runtime or set in configuration files.
The associated variable CVarMobileMultiView interacts directly with vr.MobileMultiView, as they represent the same console variable. This variable is used to query the current state of mobile multi-view rendering.
Developers must be aware that:
- This feature is specific to mobile VR rendering.
- Enabling this feature may have performance implications.
- Not all mobile platforms or devices may support this feature.
Best practices when using this variable include:
- Testing performance with and without mobile multi-view enabled to determine the optimal setting for your specific application and target devices.
- Ensuring that your shaders and rendering pipeline are compatible with mobile multi-view when enabled.
- Considering the target hardware capabilities when deciding whether to enable this feature.
The associated variable CVarMobileMultiView is used in the same way as vr.MobileMultiView. It’s a convenience variable for accessing the console variable value in C++ code. Developers should use this variable when they need to check the current state of mobile multi-view rendering in their C++ code.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneRendering.cpp:218
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarMobileMultiView(
TEXT("vr.MobileMultiView"),
0,
TEXT("0 to disable mobile multi-view, 1 to enable.\n"),
ECVF_ReadOnly | ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarRoundRobinOcclusion(
TEXT("vr.RoundRobinOcclusion"),
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/GameViewportClient.cpp:1414
Scope (from outer to inner):
file
function void UGameViewportClient::Draw
Source code excerpt:
if (GEngine->IsStereoscopic3D())
{
static const auto MobileMultiViewCVar = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("vr.MobileMultiView"));
const bool bUsingMobileRenderer = GetFeatureLevelShadingPath(MyWorld->Scene->GetFeatureLevel()) == EShadingPath::Mobile;
bRequireMultiView = (GSupportsMobileMultiView || GRHISupportsArrayIndexFromAnyShader) && bUsingMobileRenderer && (MobileMultiViewCVar && MobileMultiViewCVar->GetValueOnAnyThread() != 0);
}
FSceneViewFamilyContext ViewFamily(FSceneViewFamily::ConstructionValues(
InViewport,
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/ShaderCompiler/ShaderCompiler.cpp:8029
Scope (from outer to inner):
file
function void GlobalBeginCompileShader
Source code excerpt:
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))
{
UE_LOG(LogShaderCompilers, Warning, TEXT("Instanced stereo rendering is not supported for %s shader platform."), *ShaderFormatName.ToString());
#Loc: <Workspace>/Engine/Source/Runtime/OpenGLDrv/Private/OpenGLRenderTarget.cpp:167
Scope (from outer to inner):
file
function GLuint FOpenGLDynamicRHI::GetOpenGLFramebuffer
Source code excerpt:
VERIFY_GL(glBindFramebuffer)
static const auto CVarMobileMultiView = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("vr.MobileMultiView"));
// Allocate mobile multi-view frame buffer if enabled and supported.
// Multi-view doesn't support read buffers, explicitly disable and only bind GL_DRAW_FRAMEBUFFER
// TODO: We can't reliably use packed depth stencil?
const bool bValidMultiViewDepthTarget = !DepthStencilTarget || DepthStencilTarget->Target == GL_TEXTURE_2D_ARRAY;
const bool bUsingArrayTextures = (bRenderTargetsDefined) ? (RenderTargets[0]->Target == GL_TEXTURE_2D_ARRAY && bValidMultiViewDepthTarget) : false;
#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/StereoRenderUtils.cpp:56
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);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/MobileShadingRenderer.cpp:1510
Scope (from outer to inner):
file
function void FMobileSceneRenderer::RenderForward
Source code excerpt:
BasePassRenderTargets.ShadingRateTexture = (!MainView.bIsSceneCapture && !MainView.bIsReflectionCapture && (NewShadingRateTarget != nullptr)) ? NewShadingRateTarget : nullptr;
static const auto CVarMobileMultiView = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("vr.MobileMultiView"));
const bool bIsMultiViewApplication = (CVarMobileMultiView && CVarMobileMultiView->GetValueOnAnyThread() != 0);
//if the scenecolor isn't multiview but the app is, need to render as a single-view multiview due to shaders
BasePassRenderTargets.MultiViewCount = MainView.bIsMobileMultiViewEnabled ? 2 : (bIsMultiViewApplication ? 1 : 0);
const FRDGSystemTextures& SystemTextures = FRDGSystemTextures::Get(GraphBuilder);
#Associated Variable and Callsites
This variable is associated with another variable named CVarMobileMultiView
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/OpenGLDrv/Private/OpenGLRenderTarget.cpp:167
Scope (from outer to inner):
file
function GLuint FOpenGLDynamicRHI::GetOpenGLFramebuffer
Source code excerpt:
VERIFY_GL(glBindFramebuffer)
static const auto CVarMobileMultiView = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("vr.MobileMultiView"));
// Allocate mobile multi-view frame buffer if enabled and supported.
// Multi-view doesn't support read buffers, explicitly disable and only bind GL_DRAW_FRAMEBUFFER
// TODO: We can't reliably use packed depth stencil?
const bool bValidMultiViewDepthTarget = !DepthStencilTarget || DepthStencilTarget->Target == GL_TEXTURE_2D_ARRAY;
const bool bUsingArrayTextures = (bRenderTargetsDefined) ? (RenderTargets[0]->Target == GL_TEXTURE_2D_ARRAY && bValidMultiViewDepthTarget) : false;
const bool bMultiViewCVar = CVarMobileMultiView && CVarMobileMultiView->GetValueOnAnyThread() != 0;
if (bUsingArrayTextures && FOpenGL::SupportsMobileMultiView() && bMultiViewCVar)
{
FOpenGLTexture* const RenderTarget = RenderTargets[0];
glBindFramebuffer(GL_FRAMEBUFFER, 0);
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, Framebuffer);
#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/StereoRenderUtils.cpp:56
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);
bInstancedStereoNative = !bMobilePlatform && bInstancedStereo && RHISupportsInstancedStereo(Platform);
UE_DEBUG_SSA_LOG(Log, TEXT("--- StereoAspects begin ---"));
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/MobileShadingRenderer.cpp:1510
Scope (from outer to inner):
file
function void FMobileSceneRenderer::RenderForward
Source code excerpt:
BasePassRenderTargets.ShadingRateTexture = (!MainView.bIsSceneCapture && !MainView.bIsReflectionCapture && (NewShadingRateTarget != nullptr)) ? NewShadingRateTarget : nullptr;
static const auto CVarMobileMultiView = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("vr.MobileMultiView"));
const bool bIsMultiViewApplication = (CVarMobileMultiView && CVarMobileMultiView->GetValueOnAnyThread() != 0);
//if the scenecolor isn't multiview but the app is, need to render as a single-view multiview due to shaders
BasePassRenderTargets.MultiViewCount = MainView.bIsMobileMultiViewEnabled ? 2 : (bIsMultiViewApplication ? 1 : 0);
const FRDGSystemTextures& SystemTextures = FRDGSystemTextures::Get(GraphBuilder);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneRendering.cpp:217
Scope: file
Source code excerpt:
ECVF_ReadOnly | ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarMobileMultiView(
TEXT("vr.MobileMultiView"),
0,
TEXT("0 to disable mobile multi-view, 1 to enable.\n"),
ECVF_ReadOnly | ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarRoundRobinOcclusion(