r.Mobile.DBuffer
r.Mobile.DBuffer
#Overview
name: r.Mobile.DBuffer
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Enables DBuffer decal material blend modes when using the mobile forward renderer.\nDBuffer decals are rendered before the base pass, allowing them to affect static lighting and skylighting correctly. \nWhen enabled, a full prepass will be forced which adds CPU / GPU cost. Several texture lookups will be done in the base pass to fetch the decal properties, which adds pixel work.\n 0: off (default)\n 1: on
It is referenced in 5
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Mobile.DBuffer is to enable DBuffer decal material blend modes when using the mobile forward renderer. This setting is specifically designed for mobile platforms to enhance the rendering of decals.
This setting variable is primarily used by the rendering system in Unreal Engine, particularly for mobile platforms. It affects the Engine’s rendering module and the TargetPlatform module, which is responsible for platform-specific settings and capabilities.
The value of this variable is set through the console variable system in Unreal Engine. It’s defined in the ConsoleManager.cpp file with a default value of 0 (off).
This variable interacts with other rendering-related variables, particularly those related to decal rendering and mobile graphics. It’s closely related to the non-mobile “r.DBuffer” variable, as seen in the Material.cpp file where both are checked.
Developers must be aware of several important aspects when using this variable:
- Enabling this feature (setting to 1) will force a full prepass, which adds CPU and GPU cost.
- It affects how decals interact with static lighting and skylighting.
- When enabled, it will introduce several texture lookups in the base pass, increasing pixel work.
- This setting is specific to the mobile forward renderer and may not have an effect on other rendering paths.
Best practices when using this variable include:
- Only enable it when necessary, as it comes with performance costs.
- Test thoroughly on target mobile devices to ensure performance is acceptable when enabled.
- Consider the trade-off between visual quality improvements and performance impact.
- Use in conjunction with other decal and mobile rendering settings for optimal results.
- Be aware of how it interacts with material settings, particularly in the surface domain.
Remember that this setting is primarily for development and debugging purposes. In a shipping game, you would typically decide on a fixed setting based on your target hardware and performance requirements.
#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:4060
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarMobileDBuffer(
TEXT("r.Mobile.DBuffer"),
0,
TEXT("Enables DBuffer decal material blend modes when using the mobile forward renderer.\n"
"DBuffer decals are rendered before the base pass, allowing them to affect static lighting and skylighting correctly. \n"
"When enabled, a full prepass will be forced which adds CPU / GPU cost. Several texture lookups will be done in the base pass to fetch the decal properties, which adds pixel work.\n"
" 0: off (default)\n"
" 1: on"),
#Loc: <Workspace>/Engine/Source/Developer/TargetPlatform/Private/TargetPlatformBase.cpp:96
Scope (from outer to inner):
file
function bool FTargetPlatformBase::UsesMobileDBuffer
Source code excerpt:
bool FTargetPlatformBase::UsesMobileDBuffer() const
{
static IConsoleVariable* CVar = IConsoleManager::Get().FindConsoleVariable(TEXT("r.Mobile.DBuffer"));
return CVar ? (CVar->GetInt() != 0) : false;
}
int32 GASTCHDRProfile = 0;
static FAutoConsoleVariableRef CVarAllowASTCHDRProfile(
TEXT("cook.AllowASTCHDRProfile"),
#Loc: <Workspace>/Engine/Source/Developer/TargetPlatform/Private/TargetPlatformSettingsBase.cpp:85
Scope (from outer to inner):
file
function bool FTargetPlatformSettingsBase::UsesMobileDBuffer
Source code excerpt:
bool FTargetPlatformSettingsBase::UsesMobileDBuffer() const
{
static IConsoleVariable* CVar = IConsoleManager::Get().FindConsoleVariable(TEXT("r.Mobile.DBuffer"));
return CVar ? (CVar->GetInt() != 0) : false;
}
bool FTargetPlatformSettingsBase::UsesASTCHDR() const
{
static IConsoleVariable* CVar = IConsoleManager::Get().FindConsoleVariable(TEXT("cook.ASTCTextureCompressor"));
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Materials/Material.cpp:4493
Scope (from outer to inner):
file
function bool UMaterial::CanEditChange
Source code excerpt:
{
static auto* CVar = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.DBuffer"));
static auto* CVarMobile = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.Mobile.DBuffer"));
return MaterialDomain == MD_Surface && (CVar->GetValueOnGameThread() > 0 || CVarMobile->GetValueOnGameThread() > 0);
}
if(MaterialDomain == MD_PostProcess)
{
#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/RenderUtils.cpp:834
Scope (from outer to inner):
file
function void RenderUtilsInit
Source code excerpt:
if (IsMobilePlatform(GMaxRHIShaderPlatform))
{
static IConsoleVariable* MobileDBufferCVar = IConsoleManager::Get().FindConsoleVariable(TEXT("r.Mobile.DBuffer"));
GDBufferPlatformMask.Init(MobileDBufferCVar && MobileDBufferCVar->GetInt() && !IsMobileDeferredShadingEnabled(GMaxRHIShaderPlatform), EShaderPlatform::SP_NumPlatforms);
}
if (RayTracingCVar && RayTracingCVar->GetInt() && GRHISupportsRayTracing)
{
GRayTracingPlatformMask.Init(true, EShaderPlatform::SP_NumPlatforms);