r.FastVRam.DOFSetup
r.FastVRam.DOFSetup
#Overview
name: r.FastVRam.DOFSetup
This variable is created as a Console Variable (cvar).
- type:
Var
- help: ``
It is referenced in 7
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.FastVRam.DOFSetup is to control the texture creation flags for the Depth of Field (DOF) setup pass in Unreal Engine’s rendering pipeline. This setting is part of the Fast VRAM configuration system, which allows developers to optimize memory usage and performance for specific rendering features.
This setting variable is primarily used by the renderer subsystem, specifically in the post-processing and Depth of Field modules. Based on the callsites, it’s clear that this variable is utilized in the following areas:
- The DiaphragmDOF implementation (PostProcess/DiaphragmDOF.cpp)
- The mobile post-processing pipeline (PostProcess/PostProcessing.cpp)
- The general scene rendering setup (SceneRendering.cpp)
The value of this variable is set through the console variable system (FASTVRAM_CVAR macro) and is typically initialized with a value of 1, indicating that it’s enabled by default.
The r.FastVRam.DOFSetup variable interacts closely with other Fast VRAM configuration variables, such as r.FastVRam.DOFReduce and r.FastVRam.DOFPostfilter. These variables work together to optimize the memory usage and performance of the Depth of Field effect.
Developers should be aware that modifying this variable can affect the performance and memory usage of the Depth of Field effect. Enabling or disabling this flag can change how textures are allocated and potentially impact rendering speed and quality.
Best practices when using this variable include:
- Testing thoroughly when modifying the value to ensure it doesn’t negatively impact visual quality or performance.
- Considering the target hardware specifications when deciding whether to enable or disable this flag.
- Coordinating changes with other related Fast VRAM settings to maintain a consistent optimization strategy.
Regarding the associated variable DOFSetup, it is used within the DiaphragmDOF implementation to apply the Fast VRAM configuration flags to specific texture descriptors. This ensures that the Depth of Field setup textures are created with the appropriate optimization flags. Developers should treat this associated variable with the same considerations as the r.FastVRam.DOFSetup console variable, as they directly influence each other’s behavior in the rendering pipeline.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneRendering.cpp:499
Scope: file
Source code excerpt:
FASTVRAM_CVAR(DBufferC, 0);
FASTVRAM_CVAR(DBufferMask, 0);
FASTVRAM_CVAR(DOFSetup, 1);
FASTVRAM_CVAR(DOFReduce, 1);
FASTVRAM_CVAR(DOFPostfilter, 1);
FASTVRAM_CVAR(PostProcessMaterial, 1);
FASTVRAM_CVAR(CustomDepth, 0);
FASTVRAM_CVAR(ShadowPointLight, 0);
#Associated Variable and Callsites
This variable is associated with another variable named DOFSetup
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/DiaphragmDOF.cpp:1335
Scope (from outer to inner):
file
class class FDiaphragmDOFRecombineCS : public FDiaphragmDOFShader
Source code excerpt:
};
IMPLEMENT_GLOBAL_SHADER(FDiaphragmDOFSetupCS, "/Engine/Private/DiaphragmDOF/DOFSetup.usf", "SetupCS", SF_Compute);
IMPLEMENT_GLOBAL_SHADER(FDiaphragmDOFCocFlattenCS, "/Engine/Private/DiaphragmDOF/DOFCocTileFlatten.usf", "CocFlattenMainCS", SF_Compute);
IMPLEMENT_GLOBAL_SHADER(FDiaphragmDOFCocDilateCS, "/Engine/Private/DiaphragmDOF/DOFCocTileDilate.usf", "CocDilateMainCS", SF_Compute);
IMPLEMENT_GLOBAL_SHADER(FDiaphragmDOFDownsampleCS, "/Engine/Private/DiaphragmDOF/DOFDownsample.usf", "DownsampleCS", SF_Compute);
IMPLEMENT_GLOBAL_SHADER(FDiaphragmDOFReduceCS, "/Engine/Private/DiaphragmDOF/DOFReduce.usf", "ReduceCS", SF_Compute);
IMPLEMENT_GLOBAL_SHADER(FDiaphragmDOFScatterGroupPackCS, "/Engine/Private/DiaphragmDOF/DOFHybridScatterCompilation.usf", "ScatterGroupPackMainCS", SF_Compute);
IMPLEMENT_GLOBAL_SHADER(FDiaphragmDOFBuildBokehLUTCS, "/Engine/Private/DiaphragmDOF/DOFBokehLUT.usf", "BuildBokehLUTMainCS", SF_Compute);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/DiaphragmDOF.cpp:1570
Scope (from outer to inner):
file
function bool DiaphragmDOF::AddPasses
Source code excerpt:
HalfResGatherInputDescs.SceneColor.Extent /= PrefilteringResolutionDivisor;
HalfResGatherInputDescs.SceneColor.Format = PF_FloatRGBA;
HalfResGatherInputDescs.SceneColor.Flags |= GFastVRamConfig.DOFSetup;
HalfResGatherInputDescs.SeparateCoc = FullResDesc;
HalfResGatherInputDescs.SeparateCoc.Extent /= PrefilteringResolutionDivisor;
HalfResGatherInputDescs.SeparateCoc.Format = PF_R16F;
HalfResGatherInputDescs.SeparateCoc.Flags |= GFastVRamConfig.DOFSetup;
}
// Setup the shader parameter used in all shaders.
FDOFCommonShaderParameters CommonParameters;
CommonParameters.ViewUniformBuffer = View.ViewUniformBuffer;
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessing.cpp:2422
Scope (from outer to inner):
file
function void AddMobilePostProcessingPasses
lambda-function
Source code excerpt:
{
// AddGaussianDofBlurPass produces a blurred image from setup or potentially from taa result.
auto AddGaussianDofBlurPass = [&GraphBuilder, &View](FScreenPassTexture& DOFSetup, bool bFarPass, float KernelSizePercent)
{
const TCHAR* BlurDebugX = bFarPass ? TEXT("FarDOFBlurX") : TEXT("NearDOFBlurX");
const TCHAR* BlurDebugY = bFarPass ? TEXT("FarDOFBlurY") : TEXT("NearDOFBlurY");
FGaussianBlurInputs GaussianBlurInputs;
GaussianBlurInputs.NameX = BlurDebugX;
GaussianBlurInputs.NameY = BlurDebugY;
GaussianBlurInputs.Filter = FScreenPassTextureSlice::CreateFromScreenPassTexture(GraphBuilder, DOFSetup);
GaussianBlurInputs.TintColor = FLinearColor::White;
GaussianBlurInputs.CrossCenterWeight = FVector2f::ZeroVector;
GaussianBlurInputs.KernelSizePercent = KernelSizePercent;
return AddGaussianBlurPass(GraphBuilder, View, GaussianBlurInputs);
};
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneRendering.cpp:499
Scope: file
Source code excerpt:
FASTVRAM_CVAR(DBufferC, 0);
FASTVRAM_CVAR(DBufferMask, 0);
FASTVRAM_CVAR(DOFSetup, 1);
FASTVRAM_CVAR(DOFReduce, 1);
FASTVRAM_CVAR(DOFPostfilter, 1);
FASTVRAM_CVAR(PostProcessMaterial, 1);
FASTVRAM_CVAR(CustomDepth, 0);
FASTVRAM_CVAR(ShadowPointLight, 0);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneRendering.cpp:699
Scope (from outer to inner):
file
function void FFastVramConfig::Update
Source code excerpt:
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);
bDirty |= UpdateTextureFlagFromCVar(CVarFastVRam_ShadowPointLight, ShadowPointLight);
bDirty |= UpdateTextureFlagFromCVar(CVarFastVRam_ShadowPerObject, ShadowPerObject);
bDirty |= UpdateTextureFlagFromCVar(CVarFastVRam_ShadowCSM, ShadowCSM);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneRendering.h:2849
Scope: file
Source code excerpt:
ETextureCreateFlags DBufferC;
ETextureCreateFlags DBufferMask;
ETextureCreateFlags DOFSetup;
ETextureCreateFlags DOFReduce;
ETextureCreateFlags DOFPostfilter;
ETextureCreateFlags PostProcessMaterial;
ETextureCreateFlags CustomDepth;
ETextureCreateFlags ShadowPointLight;