r.FastVRam.SSR

r.FastVRam.SSR

#Overview

name: r.FastVRam.SSR

This variable is created as a Console Variable (cvar).

It is referenced in 23 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of r.FastVRam.SSR is to control the texture creation flags for Screen Space Reflections (SSR) textures in Unreal Engine’s rendering system. Specifically:

  1. It’s used to add additional texture creation flags for SSR-related textures to potentially optimize their memory usage or performance on certain hardware.

  2. This setting is part of the “Fast VRAM” configuration system, which allows fine-tuning of texture memory allocation for different rendering features.

  3. The value of this variable determines what additional flags are applied when creating SSR textures. These flags can affect how the texture is stored in memory and how it’s accessed by the GPU.

  4. It’s used in the ScreenSpaceRayTracing namespace when setting up textures for SSR rendering.

  5. The setting is applied to the texture descriptor’s flags before the SSR texture is created.

This variable interacts with other parts of the rendering system:

Developers should be aware that:

Best practices for using this variable include:

The associated variable SSR is used throughout the rendering code to determine when and how to apply Screen Space Reflections. It’s particularly important in determining the reflection method for different parts of the scene, including water rendering.

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneRendering.cpp:494

Scope: file

Source code excerpt:

FASTVRAM_CVAR(SeparateTranslucencyModulate, 0);
FASTVRAM_CVAR(ScreenSpaceAO,0);
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);

#Associated Variable and Callsites

This variable is associated with another variable named SSR. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/DeferredShadingRenderer.cpp:1161

Scope (from outer to inner):

file
function     void FDeferredShadingSceneRenderer::CommitFinalPipelineState

Source code excerpt:

				FamilyPipelineState[&FFamilyPipelineState::bNanite] ||
				ViewPipelineState[&FPerViewPipelineState::AmbientOcclusionMethod] == EAmbientOcclusionMethod::SSAO ||
				ViewPipelineState[&FPerViewPipelineState::ReflectionsMethod] == EReflectionsMethod::SSR ||
				bHasSSGI || bUseLumen);

			ViewPipelineState.Set(&FPerViewPipelineState::bClosestHZB, 
				bHasSSGI || bUseLumen || ManyLights::IsUsingClosestHZB());
		}
	}

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/DeferredShadingRenderer.h:299

Scope: file

Source code excerpt:

{
	Disabled,
	SSR,
	Lumen
};

/**
 * Scene renderer that implements a deferred shading pipeline and associated features.
 */

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/IndirectLightRendering.cpp:513

Scope (from outer to inner):

file
function     class FAmbientCubemapCompositePS : public FGlobalShader { /*ARE_GLOBAL_SHADER
class        class FAmbientCubemapCompositePS : public FGlobalShader
function     else if

Source code excerpt:

		else if (ScreenSpaceRayTracing::ShouldRenderScreenSpaceReflections(View))
		{
			ReflectionsMethod = EReflectionsMethod::SSR;
		}

		if (ShouldRenderLumenReflectionsWater(View))
		{
			ReflectionsMethodWater = EReflectionsMethod::Lumen;
		}
		else if (ScreenSpaceRayTracing::ShouldRenderScreenSpaceReflectionsWater(View))
		{
			ReflectionsMethodWater = EReflectionsMethod::SSR;
		}

		ViewPipelineState.Set(&FPerViewPipelineState::DiffuseIndirectMethod, DiffuseIndirectMethod);
		ViewPipelineState.Set(&FPerViewPipelineState::DiffuseIndirectDenoiser, DiffuseIndirectDenoiser);
		ViewPipelineState.Set(&FPerViewPipelineState::AmbientOcclusionMethod, AmbientOcclusionMethod);
		ViewPipelineState.Set(&FPerViewPipelineState::ReflectionsMethod, ReflectionsMethod);

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/IndirectLightRendering.cpp:1070

Scope (from outer to inner):

file
function     void FDeferredShadingSceneRenderer::RenderDiffuseIndirectAndAmbientOcclusion

Source code excerpt:

				}
			}
			else if (ViewPipelineState.ReflectionsMethod == EReflectionsMethod::SSR)
			{
				ESSRQuality SSRQuality;
				IScreenSpaceDenoiser::FReflectionsRayTracingConfig DenoiserConfig;
				ScreenSpaceRayTracing::GetSSRQualityForView(View, &SSRQuality, &DenoiserConfig);

				RDG_EVENT_SCOPE(GraphBuilder, "ScreenSpaceReflections(Quality=%d)", int32(SSRQuality));

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/IndirectLightRendering.cpp:1297

Scope (from outer to inner):

file
function     void FDeferredShadingSceneRenderer::RenderDiffuseIndirectAndAmbientOcclusion
lambda-function

Source code excerpt:

			PassParameters->ScreenBentNormalParameters = ScreenBentNormalParameters;
			PassParameters->bLumenSupportBackfaceDiffuse = ViewPipelineState.DiffuseIndirectMethod == EDiffuseIndirectMethod::Lumen && DenoiserOutputs.Textures[1] != SystemTextures.Black;
			PassParameters->bLumenReflectionInputIsSSR = ViewPipelineState.DiffuseIndirectMethod == EDiffuseIndirectMethod::Lumen && ViewPipelineState.ReflectionsMethod == EReflectionsMethod::SSR;
			extern float GLumenShortRangeAOFoliageOcclusionStrength;
			PassParameters->LumenFoliageOcclusionStrength = GLumenShortRangeAOFoliageOcclusionStrength;
			extern float GLumenMaxShortRangeAOMultibounceAlbedo;
			PassParameters->LumenMaxAOMultibounceAlbedo = GLumenMaxShortRangeAOMultibounceAlbedo;
			PassParameters->LumenReflectionSpecularScale = GetLumenReflectionSpecularScale();
			PassParameters->LumenReflectionContrast = GetLumenReflectionContrast();

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/IndirectLightRendering.cpp:1972

Scope (from outer to inner):

file
function     void FDeferredShadingSceneRenderer::RenderDeferredReflectionsAndSkyLighting

Source code excerpt:

		const FPerViewPipelineState& ViewPipelineState = GetViewPipelineState(View);

		const bool bScreenSpaceReflections = ViewPipelineState.ReflectionsMethod == EReflectionsMethod::SSR;
		const bool bComposePlanarReflections = HasDeferredPlanarReflections(View);

		FScreenSpaceReflectionTileClassification ScreenSpaceReflectionTileClassification;
		bool bRunSSRTiledComposite = false;

		FRDGTextureRef ReflectionsColor = nullptr;
		if ((ViewPipelineState.ReflectionsMethod == EReflectionsMethod::Lumen && ViewPipelineState.DiffuseIndirectMethod == EDiffuseIndirectMethod::Lumen)
			|| (ViewPipelineState.DiffuseIndirectMethod == EDiffuseIndirectMethod::Lumen && ViewPipelineState.ReflectionsMethod == EReflectionsMethod::SSR))
		{
			// Specular was already comped with FDiffuseIndirectCompositePS
			continue;
		}
		// Standalone Lumen Reflections using HWRT and hit lighting
		else if (ViewPipelineState.ReflectionsMethod == EReflectionsMethod::Lumen)

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/IndirectLightRendering.cpp:2005

Scope (from outer to inner):

file
function     void FDeferredShadingSceneRenderer::RenderDeferredReflectionsAndSkyLighting

Source code excerpt:

			StoreLumenDepthHistory(GraphBuilder, SceneTextures, View);
		}
		else if (ViewPipelineState.ReflectionsMethod == EReflectionsMethod::SSR)
		{
			int32 DenoiserMode = GetReflectionsDenoiserMode();

			// Traces the reflections, either using screen space reflection, or ray tracing.
			IScreenSpaceDenoiser::FReflectionsInputs DenoiserInputs;
			IScreenSpaceDenoiser::FReflectionsRayTracingConfig DenoiserConfig;

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenScreenProbeGather.cpp:2254

Scope (from outer to inner):

file
function     FSSDSignalTextures FDeferredShadingSceneRenderer::RenderLumenScreenProbeGather

Source code excerpt:

	FRDGTextureRef RoughSpecularIndirect = GraphBuilder.CreateTexture(RoughSpecularIndirectDesc, TEXT("Lumen.ScreenProbeGather.RoughSpecularIndirect"));

	const bool bSSREnabled = GetViewPipelineState(View).ReflectionsMethod == EReflectionsMethod::SSR;

	InterpolateAndIntegrate(
		GraphBuilder,
		SceneTextures,
		View,
		ScreenProbeParameters,

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessing.cpp:683

Scope (from outer to inner):

file
function     void AddPostProcessingPasses

Source code excerpt:

			bLocalExposureBlurredLum);
		extern int32 GSSRHalfResSceneColor;
		const bool bNeedBeforeBloomHalfRes    = (!bProcessQuarterResolution && !bProcessEighthResolution) || (bFFTBloomEnabled && FFTBloomResolutionFraction > 0.25f && FFTBloomResolutionFraction <= 0.5f) || (ReflectionsMethod == EReflectionsMethod::SSR && !View.bStatePrevViewInfoIsReadOnly && GSSRHalfResSceneColor);
		const bool bNeedBeforeBloomQuarterRes = bProcessQuarterResolution || (bFFTBloomEnabled && FFTBloomResolutionFraction > 0.125f && FFTBloomResolutionFraction <= 0.25f);
		const bool bNeedBeforeBloomEighthRes  = bProcessEighthResolution || (bFFTBloomEnabled && FFTBloomResolutionFraction <= 0.125f);


		const FPostProcessMaterialChain MaterialChainSceneColorBeforeDOF = GetPostProcessMaterialChain(View, BL_SceneColorBeforeDOF);
		const FPostProcessMaterialChain MaterialChainSceneColorAfterDOF = GetPostProcessMaterialChain(View, BL_SceneColorAfterDOF);

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessing.cpp:868

Scope (from outer to inner):

file
function     void AddPostProcessingPasses

Source code excerpt:

			}
		}
		else if (ReflectionsMethod == EReflectionsMethod::SSR)
		{
			// If we need SSR, and TAA is enabled, then AddTemporalAAPass() has already handled the scene history.
			// If we need SSR, and TAA is not enable, then we just need to extract the history.
			if (!View.bStatePrevViewInfoIsReadOnly)
			{
				check(View.ViewState);

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessing.cpp:1029

Scope (from outer to inner):

file
function     void AddPostProcessingPasses

Source code excerpt:


		// Store half res scene color in the history
		if (ReflectionsMethod == EReflectionsMethod::SSR && !View.bStatePrevViewInfoIsReadOnly && GSSRHalfResSceneColor && HalfResSceneColor.IsValid())
		{
			check(View.ViewState);
			GraphBuilder.QueueTextureExtraction(HalfResSceneColor.TextureSRV->Desc.Texture, &View.ViewState->PrevFrameViewInfo.HalfResTemporalAAHistory);
		}

		{

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneRendering.cpp:494

Scope: file

Source code excerpt:

FASTVRAM_CVAR(SeparateTranslucencyModulate, 0);
FASTVRAM_CVAR(ScreenSpaceAO,0);
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);

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneRendering.cpp:694

Scope (from outer to inner):

file
function     void FFastVramConfig::Update

Source code excerpt:

	bDirty |= UpdateTextureFlagFromCVar(CVarFastVRam_SeparateTranslucencyModulate, SeparateTranslucencyModulate);
	bDirty |= UpdateTextureFlagFromCVar(CVarFastVRam_ScreenSpaceAO, ScreenSpaceAO);
	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);

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneRendering.h:2844

Scope: file

Source code excerpt:

	ETextureCreateFlags SeparateTranslucencyModulate;
	ETextureCreateFlags ScreenSpaceAO;
	ETextureCreateFlags SSR;
	ETextureCreateFlags DBufferA;
	ETextureCreateFlags DBufferB;
	ETextureCreateFlags DBufferC;
	ETextureCreateFlags DBufferMask;
	ETextureCreateFlags DOFSetup;
	ETextureCreateFlags DOFReduce;

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ScreenSpaceRayTracing.cpp:1036

Scope (from outer to inner):

file
namespace    ScreenSpaceRayTracing
function     void RenderScreenSpaceReflections

Source code excerpt:

			TexCreate_RenderTargetable | TexCreate_ShaderResource | TexCreate_UAV | TexCreate_NoFastClear);

		Desc.Flags |= GFastVRamConfig.SSR;

		DenoiserInputs->Color = GraphBuilder.CreateTexture(Desc, TEXT("ScreenSpaceReflections"));

		if (bDenoiser)
		{
			Desc.Format = PF_R16F;

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ScreenSpaceRayTracing.cpp:1176

Scope (from outer to inner):

file
namespace    ScreenSpaceRayTracing
function     void RenderScreenSpaceReflections

Source code excerpt:

	PassParameters->Substrate = Substrate::BindSubstrateGlobalUniformParameters(View);
	PassParameters->RenderTargets = RenderTargets;
	PassParameters->RenderTargets.ShadingRateTexture = GVRSImageManager.GetVariableRateShadingImage(GraphBuilder, View, FVariableRateShadingImageManager::EVRSPassType::SSR);

	TShaderMapRef<FScreenSpaceReflectionsPS> PixelShader(View.ShaderMap, PermutationVector);

	RDG_GPU_STAT_SCOPE(GraphBuilder, ScreenSpaceReflections);

	static const auto CVarSSRTiledCompositeVisualize = IConsoleManager::Get().FindTConsoleVariableDataBool(TEXT("r.SSR.TiledComposite.Visualize"));

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SingleLayerWaterRendering.cpp:45

Scope (from outer to inner):

file
namespace    ESingleLayerWaterReflections

Source code excerpt:

		Enabled				= 1, // Same reflection technique as the rest of the scene.
		ReflectionCaptures	= 2, // Force using reflection captures and skylight (cubemaps) only.
		SSR					= 3, // Force using SSR (includes cubemaps). Will fall back to cubemaps only if SSR is not supported.
		MaxValue			= SSR
	};
}

static TAutoConsoleVariable<int32> CVarWaterSingleLayerReflection(
	TEXT("r.Water.SingleLayer.Reflection"), 1,
	TEXT("Reflection technique to use on single layer water. 0: Disabled, 1: Enabled (same as rest of scene), 2: Force Reflection Captures and Sky, 3: Force SSR"),

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SingleLayerWaterRendering.cpp:178

Scope (from outer to inner):

file
namespace    ScreenSpaceRayTracing
function     bool ShouldRenderScreenSpaceReflectionsWater

Source code excerpt:

{
	const int32 ReflectionsMethod = GetSingleLayerWaterReflectionTechnique();
	const bool bSSROverride = ReflectionsMethod == ESingleLayerWaterReflections::SSR;
	// Note: intentionally allow falling back to SSR from other reflection methods, which may be disabled by scalability (see ShouldRenderScreenSpaceReflections())
	const bool bSSRDefault = ReflectionsMethod == ESingleLayerWaterReflections::Enabled && View.FinalPostProcessSettings.ReflectionMethod != EReflectionMethod::None;

	if (!View.Family->EngineShowFlags.ScreenSpaceReflections
		|| (!bSSROverride && !bSSRDefault)
		|| HasRayTracedOverlay(*View.Family)

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SingleLayerWaterRendering.cpp:1021

Scope: file

Source code excerpt:

				ERDGPassFlags::Compute);
		}
		else if (ViewPipelineState.ReflectionsMethodWater == EReflectionsMethod::SSR)
		{
			check(ScreenSpaceRayTracing::ShouldRenderScreenSpaceReflectionsWater(View));
			// RUN SSR
			// Uses the water GBuffer (depth, ABCDEF) to know how to start tracing.
			// The water scene depth is used to know where to start tracing.
			// Then it uses the scene HZB for the ray casting process.

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VariableRateShading/VariableRateShadingImageManager.cpp:772

Scope: file

Source code excerpt:

			CVarByPassType[EVRSPassType::NaniteEmitGBufferPass] = &CVarVRSNaniteEmitGBuffer;
			CVarByPassType[EVRSPassType::SSAO] = &CVarVRS_SSAO;
			CVarByPassType[EVRSPassType::SSR] = &CVarVRS_SSR;
			CVarByPassType[EVRSPassType::ReflectionEnvironmentAndSky] = &CVarVRSReflectionEnvironmentSky;
			CVarByPassType[EVRSPassType::LightFunctions] = &CVarVRSLightFunctions;
			CVarByPassType[EVRSPassType::Decals] = &CVarVRSDecals;
		}
	} StaticData;

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VelocityRendering.cpp:201

Scope (from outer to inner):

file
function     bool FDeferredShadingSceneRenderer::ShouldRenderVelocities

Source code excerpt:

		bool bDistanceFieldAO = ShouldPrepareForDistanceFieldAO();

		bool bSceneSSREnabled = ViewPipelineState.ReflectionsMethod == EReflectionsMethod::SSR && ScreenSpaceRayTracing::ShouldRenderScreenSpaceReflections(View);
		bool bWaterSSREnabled = ViewPipelineState.ReflectionsMethodWater == EReflectionsMethod::SSR && ScreenSpaceRayTracing::ShouldRenderScreenSpaceReflectionsWater(View);
		bool bSSRTemporal = (bSceneSSREnabled || bWaterSSREnabled) && ScreenSpaceRayTracing::IsSSRTemporalPassRequired(View);

		bool bRayTracing = IsRayTracingEnabled();
		bool bDenoise = bRayTracing;

		bool bSSGI = ViewPipelineState.DiffuseIndirectMethod == EDiffuseIndirectMethod::SSGI;

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Public/VariableRateShadingImageManager.h:30

Scope (from outer to inner):

file
class        class FVariableRateShadingImageManager : public FRenderResource

Source code excerpt:

		NaniteEmitGBufferPass,
		SSAO,
		SSR,
		ReflectionEnvironmentAndSky,
		LightFunctions,
		Decals,
		Num
	};