r.Mobile.AdrenoOcclusionMode
r.Mobile.AdrenoOcclusionMode
#Overview
name: r.Mobile.AdrenoOcclusionMode
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
0: Render occlusion queries after the base pass (default).\n1: Render occlusion queries after translucency and a flush, which can help Adreno devices in GL mode.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Mobile.AdrenoOcclusionMode is to control the timing of occlusion query rendering on mobile devices, specifically for Adreno GPUs when using OpenGL.
This setting variable is primarily used in the mobile rendering system of Unreal Engine 5. It’s referenced in the MobileShadingRenderer module, which is part of the Renderer subsystem.
The value of this variable is set through a console variable (CVarMobileAdrenoOcclusionMode) in the engine’s configuration system. It can be set to either 0 or 1: 0: Render occlusion queries after the base pass (default) 1: Render occlusion queries after translucency and a flush, which can help Adreno devices in GL mode
The associated variable CVarMobileAdrenoOcclusionMode directly interacts with r.Mobile.AdrenoOcclusionMode. They share the same value and purpose.
Developers must be aware that this variable specifically targets Adreno GPUs when using OpenGL on mobile devices. It’s designed to address potential performance issues related to occlusion query timing on these specific hardware configurations.
Best practices when using this variable include:
- Only modify this setting if you’re experiencing performance issues related to occlusion queries on Adreno devices using OpenGL.
- Test thoroughly on target devices when changing this setting, as it can impact rendering performance and visual quality.
- Consider this setting in conjunction with other mobile rendering optimizations.
Regarding the associated variable CVarMobileAdrenoOcclusionMode:
The purpose of CVarMobileAdrenoOcclusionMode is the same as r.Mobile.AdrenoOcclusionMode. It’s the actual console variable that controls the Adreno occlusion mode setting.
This variable is used in the mobile rendering system, specifically in the MobileShadingRenderer module of the Renderer subsystem.
The value of CVarMobileAdrenoOcclusionMode is set when the engine initializes its console variables. It can be modified at runtime through console commands or configuration files.
In the provided code, we can see that CVarMobileAdrenoOcclusionMode directly influences the rendering behavior. When its value is non-zero and the platform is using OpenGL, it triggers a flush operation before rendering occlusion queries.
Developers should be aware that modifying this variable can have direct impacts on rendering performance, especially on Adreno devices using OpenGL.
Best practices for CVarMobileAdrenoOcclusionMode align with those for r.Mobile.AdrenoOcclusionMode, as they are essentially the same setting.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/MobileShadingRenderer.cpp:85
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarMobileAdrenoOcclusionMode(
TEXT("r.Mobile.AdrenoOcclusionMode"),
0,
TEXT("0: Render occlusion queries after the base pass (default).\n")
TEXT("1: Render occlusion queries after translucency and a flush, which can help Adreno devices in GL mode."),
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarMobileCustomDepthForTranslucency(
#Associated Variable and Callsites
This variable is associated with another variable named CVarMobileAdrenoOcclusionMode
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/MobileShadingRenderer.cpp:84
Scope: file
Source code excerpt:
ECVF_Scalability | ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarMobileAdrenoOcclusionMode(
TEXT("r.Mobile.AdrenoOcclusionMode"),
0,
TEXT("0: Render occlusion queries after the base pass (default).\n")
TEXT("1: Render occlusion queries after translucency and a flush, which can help Adreno devices in GL mode."),
ECVF_RenderThreadSafe);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/MobileShadingRenderer.cpp:1634
Scope (from outer to inner):
file
function void FMobileSceneRenderer::RenderForwardSinglePass
lambda-function
Source code excerpt:
// Issue occlusion queries
RHICmdList.SetCurrentStat(GET_STATID(STAT_CLMM_Occlusion));
const bool bAdrenoOcclusionMode = (CVarMobileAdrenoOcclusionMode.GetValueOnRenderThread() != 0 && IsOpenGLPlatform(ShaderPlatform));
if (bAdrenoOcclusionMode)
{
// flush
RHICmdList.SubmitCommandsHint();
}
RenderOcclusion(RHICmdList);