r.FastVRam.DBufferB
r.FastVRam.DBufferB
#Overview
name: r.FastVRam.DBufferB
This variable is created as a Console Variable (cvar).
- type:
Var
- help: ``
It is referenced in 11
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.FastVRam.DBufferB is to control the texture creation flags for the DBufferB texture in Unreal Engine 5’s rendering system. DBufferB is part of the Decal Buffer system, which is used for efficient rendering of decals in the engine.
This setting variable is primarily used by the renderer subsystem of Unreal Engine 5. Specifically, it’s utilized in the deferred decal rendering process, which is a part of the larger deferred rendering pipeline.
The value of this variable is typically set through a console variable (CVar) system, as indicated by the FASTVRAM_CVAR macro used in the SceneRendering.cpp file.
This variable interacts closely with other DBuffer-related variables, namely DBufferA and DBufferC. Together, these variables control the creation and management of the Decal Buffer textures.
Developers should be aware that modifying this variable can affect the memory allocation and performance characteristics of the decal rendering system. It’s part of the FastVRam configuration, which is used to optimize texture memory usage on certain hardware.
Best practices when using this variable include:
- Only modifying it if you have a deep understanding of the rendering pipeline and memory management in Unreal Engine.
- Testing any changes thoroughly across different hardware configurations.
- Considering the impact on overall rendering performance and memory usage.
The associated variable DBufferB is used directly in texture creation and rendering passes. It represents the actual texture resource for the second component of the Decal Buffer. This texture is created with the flags specified by r.FastVRam.DBufferB and is used in various parts of the decal rendering process, including the deferred decal pass and the DBuffer mask combination step.
When working with DBufferB, developers should:
- Ensure it’s always created and used alongside DBufferA and DBufferC.
- Be aware of its role in storing specific decal information (likely normal or roughness data, based on typical DBuffer layouts).
- Consider its impact on memory usage and rendering performance, especially on platforms with limited video memory.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneRendering.cpp:496
Scope: file
Source code excerpt:
FASTVRAM_CVAR(SSR, 0);
FASTVRAM_CVAR(DBufferA, 0);
FASTVRAM_CVAR(DBufferB, 0);
FASTVRAM_CVAR(DBufferC, 0);
FASTVRAM_CVAR(DBufferMask, 0);
FASTVRAM_CVAR(DOFSetup, 1);
FASTVRAM_CVAR(DOFReduce, 1);
FASTVRAM_CVAR(DOFPostfilter, 1);
FASTVRAM_CVAR(PostProcessMaterial, 1);
#Associated Variable and Callsites
This variable is associated with another variable named DBufferB
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/CompositionLighting/PostProcessDeferredDecals.cpp:218
Scope (from outer to inner):
file
function void GetDeferredDecalPassParameters
Source code excerpt:
AddColorTarget(DBufferTextures.DBufferA, LoadAction);
AddColorTarget(DBufferTextures.DBufferB, LoadAction);
AddColorTarget(DBufferTextures.DBufferC, LoadAction);
if (DBufferTextures.DBufferMask)
{
AddColorTarget(DBufferTextures.DBufferMask, LoadAction);
}
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/CompositionLighting/PostProcessDeferredDecals.cpp:730
Scope (from outer to inner):
file
function void AddDeferredDecalPass
Source code excerpt:
{
// Combine DBuffer RTWriteMasks; will end up in one texture we can load from in the base pass PS and decide whether to do the actual work or not.
FRDGTextureRef Textures[] = { PassTextures.DBufferTextures->DBufferA, PassTextures.DBufferTextures->DBufferB, PassTextures.DBufferTextures->DBufferC };
FRenderTargetWriteMask::Decode(GraphBuilder, View.ShaderMap, MakeArrayView(Textures), PassTextures.DBufferTextures->DBufferMask, GFastVRamConfig.DBufferMask, TEXT("DBufferMaskCombine"));
}
}
void ExtractNormalsForNextFrameReprojection(FRDGBuilder& GraphBuilder, const FSceneTextures& SceneTextures, const TArray<FViewInfo>& Views)
{
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/DBufferTextures.cpp:11
Scope (from outer to inner):
file
function bool FDBufferTextures::IsValid
Source code excerpt:
bool FDBufferTextures::IsValid() const
{
check(!DBufferA || (DBufferB && DBufferC));
return HasBeenProduced(DBufferA);
}
EDecalDBufferMaskTechnique GetDBufferMaskTechnique(EShaderPlatform ShaderPlatform)
{
const bool bWriteMaskDBufferMask = RHISupportsRenderTargetWriteMask(ShaderPlatform);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/DBufferTextures.cpp:48
Scope (from outer to inner):
file
function FDBufferTexturesDesc GetDBufferTexturesDesc
Source code excerpt:
DBufferTexturesDesc.DBufferADesc = Desc;
Desc.Flags = BaseFlags | GFastVRamConfig.DBufferB;
Desc.ClearValue = FClearValueBinding(FLinearColor(128.0f / 255.0f, 128.0f / 255.0f, 128.0f / 255.0f, 1));
DBufferTexturesDesc.DBufferBDesc = Desc;
Desc.Flags = BaseFlags | GFastVRamConfig.DBufferC;
Desc.ClearValue = FClearValueBinding(FLinearColor(0, 0, 0, 1));
DBufferTexturesDesc.DBufferCDesc = Desc;
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/DBufferTextures.cpp:90
Scope (from outer to inner):
file
function FDBufferTextures CreateDBufferTextures
Source code excerpt:
DBufferTextures.DBufferA = GraphBuilder.CreateTexture(TexturesDesc.DBufferADesc, TEXT("DBufferA"), TextureFlags);
DBufferTextures.DBufferB = GraphBuilder.CreateTexture(TexturesDesc.DBufferBDesc, TEXT("DBufferB"), TextureFlags);
DBufferTextures.DBufferC = GraphBuilder.CreateTexture(TexturesDesc.DBufferCDesc, TEXT("DBufferC"), TextureFlags);
if (DBufferMaskTechnique == EDecalDBufferMaskTechnique::PerPixel)
{
DBufferTextures.DBufferMask = GraphBuilder.CreateTexture(TexturesDesc.DBufferMaskDesc, TEXT("DBufferMask"));
}
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/DBufferTextures.cpp:118
Scope (from outer to inner):
file
function FDBufferParameters GetDBufferParameters
Source code excerpt:
{
Parameters.DBufferATexture = DBufferTextures.DBufferA;
Parameters.DBufferBTexture = DBufferTextures.DBufferB;
Parameters.DBufferCTexture = DBufferTextures.DBufferC;
if (DBufferTextures.DBufferMask)
{
Parameters.DBufferRenderMask = DBufferTextures.DBufferMask;
}
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/DBufferTextures.h:33
Scope: file
Source code excerpt:
FRDGTextureRef DBufferA = nullptr;
FRDGTextureRef DBufferB = nullptr;
FRDGTextureRef DBufferC = nullptr;
FRDGTextureRef DBufferMask = nullptr;
};
FDBufferTexturesDesc GetDBufferTexturesDesc(FIntPoint Extent, EShaderPlatform ShaderPlatform);
FDBufferTextures CreateDBufferTextures(FRDGBuilder& GraphBuilder, FIntPoint Extent, EShaderPlatform ShaderPlatform);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneRendering.cpp:496
Scope: file
Source code excerpt:
FASTVRAM_CVAR(SSR, 0);
FASTVRAM_CVAR(DBufferA, 0);
FASTVRAM_CVAR(DBufferB, 0);
FASTVRAM_CVAR(DBufferC, 0);
FASTVRAM_CVAR(DBufferMask, 0);
FASTVRAM_CVAR(DOFSetup, 1);
FASTVRAM_CVAR(DOFReduce, 1);
FASTVRAM_CVAR(DOFPostfilter, 1);
FASTVRAM_CVAR(PostProcessMaterial, 1);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneRendering.cpp:696
Scope (from outer to inner):
file
function void FFastVramConfig::Update
Source code excerpt:
bDirty |= UpdateTextureFlagFromCVar(CVarFastVRam_SSR, SSR);
bDirty |= UpdateTextureFlagFromCVar(CVarFastVRam_DBufferA, DBufferA);
bDirty |= UpdateTextureFlagFromCVar(CVarFastVRam_DBufferB, DBufferB);
bDirty |= UpdateTextureFlagFromCVar(CVarFastVRam_DBufferC, DBufferC);
bDirty |= UpdateTextureFlagFromCVar(CVarFastVRam_DBufferMask, DBufferMask);
bDirty |= UpdateTextureFlagFromCVar(CVarFastVRam_DOFSetup, DOFSetup);
bDirty |= UpdateTextureFlagFromCVar(CVarFastVRam_DOFReduce, DOFReduce);
bDirty |= UpdateTextureFlagFromCVar(CVarFastVRam_DOFPostfilter, DOFPostfilter);
bDirty |= UpdateTextureFlagFromCVar(CVarFastVRam_CustomDepth, CustomDepth);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneRendering.h:2846
Scope: file
Source code excerpt:
ETextureCreateFlags SSR;
ETextureCreateFlags DBufferA;
ETextureCreateFlags DBufferB;
ETextureCreateFlags DBufferC;
ETextureCreateFlags DBufferMask;
ETextureCreateFlags DOFSetup;
ETextureCreateFlags DOFReduce;
ETextureCreateFlags DOFPostfilter;
ETextureCreateFlags PostProcessMaterial;