ShowFlag.EyeAdaptation

ShowFlag.EyeAdaptation

#Overview

name: ShowFlag.EyeAdaptation

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

It is referenced in 68 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of ShowFlag.EyeAdaptation is to control the visibility of the eye adaptation post-processing effect in Unreal Engine’s rendering pipeline. Eye adaptation, also known as auto exposure, simulates how the human eye adjusts to different light levels in a scene.

Key points about ShowFlag.EyeAdaptation:

  1. It’s part of the post-processing system, specifically related to HDR (High Dynamic Range) rendering.

  2. The Renderer and PostProcess modules primarily rely on this setting variable.

  3. The value is typically set through engine show flags, which can be controlled via the UI or programmatically.

  4. It interacts closely with other variables related to exposure and HDR rendering, such as AutoExposure settings.

  5. Developers should be aware that disabling this flag will cause the engine to use a fixed exposure value instead of dynamically adapting to the scene’s brightness.

  6. Best practices include:

    • Ensuring it’s enabled for realistic lighting in HDR scenes
    • Using it in conjunction with other exposure controls for fine-tuned results
    • Being cautious when disabling it, as it may lead to over or underexposed scenes

Regarding the associated variable EyeAdaptation:

  1. This variable is used in various shaders and compute passes to actually implement the eye adaptation effect.

  2. It’s typically a texture or buffer containing exposure information calculated from the scene’s luminance.

  3. The value is updated each frame based on the scene’s overall brightness.

  4. It’s used in tonemapping and other post-processing effects to adjust the final image based on the calculated exposure.

  5. Developers should be aware that this value may lag behind the current frame, as it’s often based on the previous frame’s luminance to prevent rapid fluctuations.

  6. Best practices include:

    • Ensuring proper initialization of this variable to prevent unexpected behavior in the first frames
    • Considering the update rate and adaptation speed for the desired visual effect
    • Using it consistently across all relevant post-processing passes for coherent results

In summary, ShowFlag.EyeAdaptation controls the visibility of the effect, while EyeAdaptation holds the actual exposure data used in rendering calculations.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/ShowFlagsValues.inl:33

Scope: file

Source code excerpt:

SHOWFLAG_ALWAYS_ACCESSIBLE(AmbientCubemap, SFG_LightingFeatures, NSLOCTEXT("UnrealEd", "AmbientCubemapSF", "Ambient Cubemap"))
/** Human like eye simulation to adapt to the brightness of the view, for now SHOWFLAG_ALWAYS_ACCESSIBLE because it's exposed in SceneCapture */
SHOWFLAG_ALWAYS_ACCESSIBLE(EyeAdaptation, SFG_PostProcess, NSLOCTEXT("UnrealEd", "EyeAdaptationSF", "Eye Adaptation"))
/** Display a histogram of the scene HDR color */
SHOWFLAG_FIXED_IN_SHIPPING(0, VisualizeHDR, SFG_Visualize, NSLOCTEXT("UnrealEd", "VisualizeHDRSF", "HDR (Eye Adaptation)"))
/** Display the illuminance debug view for the skylight */
SHOWFLAG_FIXED_IN_SHIPPING(0, VisualizeSkyLightIlluminance, SFG_Visualize, NSLOCTEXT("UnrealEd", "VisualizeSkyLightIlluminance", "Visualize SkyLight Illuminance"))
/** Helper to tweak local expsoure settings */
SHOWFLAG_FIXED_IN_SHIPPING(0, VisualizeLocalExposure, SFG_Visualize, NSLOCTEXT("UnrealEd", "VisualizeLocalExposureSF", "Local Exposure"))

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Plugins/Compositing/Composure/Source/Composure/Private/ComposureTonemapperPass.cpp:51

Scope (from outer to inner):

file
function     void UComposureTonemapperPass::TonemapToRenderTarget

Source code excerpt:

{
	// Disables as much stuf as possible using showflags. 
	FComposureUtils::SetEngineShowFlagsForPostprocessingOnly(SceneCapture->ShowFlags);

	FComposureTonemapperUtils::ApplyTonemapperSettings(ColorGradingSettings, FilmStockSettings, ChromaticAberration, SceneCapture->PostProcessSettings);
	//SceneCapture->ShowFlags.EyeAdaptation = true;

	// Adds the blendable to have programmatic control of FSceneView::FinalPostProcessSettings
	// in  UComposurePostProcessPass::OverrideBlendableSettings().
	SceneCapture->PostProcessSettings.AddBlendable(BlendableInterface, 1.0);

	SceneCapture->ProfilingEventName = TEXT("ComposureTonemapperPass");

	// OverrideBlendableSettings() will do nothing (see UMaterialInterface::OverrideBlendableSettings) 
	// with these materials unless there is a ViewState from the capture component (see USceneCaptureComponent::GetViewState)
	TGuardValue<bool> ViewStateGuard(SceneCapture->bAlwaysPersistRenderingState, true);

#Loc: <Workspace>/Engine/Plugins/Compositing/Composure/Source/Composure/Private/ComposureTonemapperPass.cpp:76

Scope (from outer to inner):

file
function     void UComposureTonemapperPassPolicy::SetupPostProcess_Implementation

Source code excerpt:

{
	// Do not replace the engine's tonemapper.
	OutTonemapperOverride = nullptr;

	FComposureTonemapperUtils::ApplyTonemapperSettings(ColorGradingSettings, FilmStockSettings, ChromaticAberration, SceneCapture->PostProcessSettings);
	//SceneCapture->ShowFlags.EyeAdaptation = true;
}

#Loc: <Workspace>/Engine/Plugins/Compositing/Composure/Source/Composure/Private/ComposureUtils.cpp:17

Scope (from outer to inner):

file
function     void FComposureUtils::SetEngineShowFlagsForPostprocessingOnly

Source code excerpt:

	EngineShowFlags.Decals = false;
	EngineShowFlags.Translucency = false;
	EngineShowFlags.AntiAliasing = false;
	EngineShowFlags.MotionBlur = false;
	EngineShowFlags.Bloom = false;
	EngineShowFlags.EyeAdaptation = false;
	EngineShowFlags.VolumetricFog = false;
	EngineShowFlags.Atmosphere = false;
	EngineShowFlags.Fog = false;

#if !UE_BUILD_OPTIMIZED_SHOWFLAGS
	// Development-only flags
	EngineShowFlags.ReflectionOverride = false;
	EngineShowFlags.DepthOfField = false;
#endif
}

#Loc: <Workspace>/Engine/Plugins/Experimental/DynamicMaterial/Source/DynamicMaterialEditor/Public/Components/DMMaterialStageExpression.h:101

Scope: file

Source code excerpt:

DeriveNormalZ
Desaturation
Distance
DistanceCullFade
CloudLayer
EyeAdaptation
EyeAdaptationInverse
Frac
Fresnel
FunctionInput
FunctionOutput
GIReplace
HairAttributes
HairColor
PrecomputedAOMask
LightmassReplace
MaterialProxyReplace
NaniteReplace
Noise
Normalize
PreSkinnedLocalBounds
ShadowReplace
PerInstanceFadeAmount
PerInstanceRandom
PerInstanceCustomData
PreSkinnedNormal
PreSkinnedPosition
RuntimeVirtualTextureOutput
RuntimeVirtualTextureReplace
RuntimeVirtualTextureSample
Saturate
SceneDepthWithoutWater --
ISceneTexelSize
SceneTexture
SingleLayerWaterMaterialOutput
ThinTranslucentMaterialOutput
Sobol
SpeedTree
SphereMask
SphericalParticleOpacity
TangentOutput
TemporalSobol
TextureObject
TextureProperty
AntialiasedTextureMask
TwoSidedSign
VectorNoise
VertexInterpolator
ViewProperty
DistanceToNearestSurface
DistanceFieldGradient
AtmosphericLightVector
AtmosphericLightColor
SkyAtmosphereLightIlluminance
SkyAtmosphereLightDirection
SkyAtmosphereViewLuminance
SkyLightEnvMapSample
MapARPassthroughCameraUV
SamplePhysicsField
GetLocal

 */

#Loc: <Workspace>/Engine/Plugins/Runtime/nDisplay/Source/DisplayClusterConfigurator/Private/Views/Viewport/DisplayClusterConfiguratorSCSEditorViewportClient.cpp:63

Scope (from outer to inner):

file
function     FDisplayClusterConfiguratorSCSEditorViewportClient::FDisplayClusterConfiguratorSCSEditorViewportClient

Source code excerpt:

	SetViewMode(VMI_Lit);

	SyncEditorSettings();

	EngineShowFlags.AntiAliasing = DisplayClusterSettings->bEditorEnableAA;
	EngineShowFlags.EyeAdaptation = false;
	
	//OverrideNearClipPlane(1.0f);
	bUsingOrbitCamera = true;

	//This seems to be needed to get the correct world time in the preview.
	SetIsSimulateInEditorViewport(true);
	ResetCamera();
	
	const FTransform Transform(FRotator(0, 0, 0), FVector(0, 0, 0), FVector(1));
	
	CurrentProfileIndex = DefaultSettings->Profiles.IsValidIndex(CurrentProfileIndex) ? GetDefault<UEditorPerProjectUserSettings>()->AssetViewerProfileIndex : 0;

#Loc: <Workspace>/Engine/Source/Developer/FunctionalTesting/Private/AutomationBlueprintFunctionLibrary.cpp:188

Scope (from outer to inner):

file
class        class FAutomationViewExtension : public FWorldSceneViewExtension
function     virtual void SetupViewFamily

Source code excerpt:

			ShowFlags.SetTemporalAA(ViewSettings->TemporalAA);
			ShowFlags.SetScreenSpaceReflections(ViewSettings->ScreenSpaceReflections);
			ShowFlags.SetScreenSpaceAO(ViewSettings->ScreenSpaceAO);
			ShowFlags.SetDistanceFieldAO(ViewSettings->DistanceFieldAO);
			ShowFlags.SetContactShadows(ViewSettings->ContactShadows);
			ShowFlags.SetEyeAdaptation(ViewSettings->EyeAdaptation);
			ShowFlags.SetBloom(ViewSettings->Bloom);
		}

		if (Options.bOverride_OverrideTimeTo)
		{
			// Turn off time the ultimate source of noise.
			InViewFamily.Time = FGameTime::CreateUndilated(Options.OverrideTimeTo, 0.0f);
		}

		if (Options.bDisableNoisyRenderingFeatures)
	{

#Loc: <Workspace>/Engine/Source/Developer/FunctionalTesting/Private/AutomationBlueprintFunctionLibrary.cpp:211

Scope (from outer to inner):

file
class        class FAutomationViewExtension : public FWorldSceneViewExtension
function     virtual void SetupViewFamily

Source code excerpt:

			////InViewFamily.EngineShowFlags.SetDistanceFieldAO(false);
			//InViewFamily.EngineShowFlags.SetContactShadows(false);
			//InViewFamily.EngineShowFlags.SetEyeAdaptation(false);

			//TODO Auto Exposure?
			//TODO EyeAdaptation Gamma?

			// Disable screen percentage.
			//InViewFamily.EngineShowFlags.SetScreenPercentage(false);
		}

		if (Options.bDisableTonemapping)
		{
			//InViewFamily.EngineShowFlags.SetEyeAdaptation(false);
			//InViewFamily.EngineShowFlags.SetTonemapper(false);
		}
	}

#Loc: <Workspace>/Engine/Source/Developer/FunctionalTesting/Public/AutomationViewSettings.h:19

Scope (from outer to inner):

file
class        class UAutomationViewSettings : public UDataAsset
function     UAutomationViewSettings

Source code excerpt:

		, TemporalAA(true)
		, ScreenSpaceReflections(true)
		, ScreenSpaceAO(true)
		, DistanceFieldAO(true)
		, ContactShadows(true)
		, EyeAdaptation(true)
		, Bloom(true)
	{
	}

	UPROPERTY(EditAnywhere, Category="Rendering")
	bool AntiAliasing;
	
	UPROPERTY(EditAnywhere, Category="Rendering")
	bool MotionBlur;
	
	UPROPERTY(EditAnywhere, Category="Rendering")

#Loc: <Workspace>/Engine/Source/Developer/FunctionalTesting/Public/AutomationViewSettings.h:46

Scope (from outer to inner):

file
class        class UAutomationViewSettings : public UDataAsset

Source code excerpt:

	
	UPROPERTY(EditAnywhere, Category="Rendering")
	bool ContactShadows;
	
	UPROPERTY(EditAnywhere, Category="Rendering")
	bool EyeAdaptation;

	UPROPERTY(EditAnywhere, Category = "Rendering")
	bool Bloom;
};

#Loc: <Workspace>/Engine/Source/Editor/MovieSceneTools/Private/TrackEditorThumbnail/TrackEditorThumbnail.cpp:421

Scope (from outer to inner):

file
function     void FTrackEditorThumbnailCache::DrawViewportThumbnail

Source code excerpt:

	case EThumbnailQuality::Normal:
	case EThumbnailQuality::Best:
		ViewFamily.EngineShowFlags.SetMotionBlur(false);

		// Default eye adaptation requires a viewstate.
		ViewFamily.EngineShowFlags.EyeAdaptation = true;
		UMovieSceneUserThumbnailSettings* ThumbnailSettings = GetMutableDefault<UMovieSceneUserThumbnailSettings>();
		FSceneViewStateInterface* Ref = ThumbnailSettings->ViewState.GetReference();
		if (!Ref)
		{
			ThumbnailSettings->ViewState.Allocate(ViewFamily.GetFeatureLevel());
		}
		ViewStateInterface = ThumbnailSettings->ViewState.GetReference();
		break;
	}

	FSceneViewInitOptions ViewInitOptions;

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/Materials/MaterialExpressionEyeAdaptation.h:5

Scope: file

Source code excerpt:

#include "UObject/ObjectMacros.h"
#include "Materials/MaterialExpression.h"
#include "MaterialExpressionEyeAdaptation.generated.h"

/**
 * Provides access to the EyeAdaptation render target.
 */


UCLASS(collapsecategories, hidecategories=Object)
class UMaterialExpressionEyeAdaptation : public UMaterialExpression
{
	GENERATED_UCLASS_BODY()

	//~ Begin UMaterialExpression Interface
#if WITH_EDITOR
	virtual int32 Compile(class FMaterialCompiler* Compiler, int32 OutputIndex) override;
	virtual void GetCaption(TArray<FString>& OutCaptions) const override;
	virtual bool GenerateHLSLExpression(FMaterialHLSLGenerator& Generator, UE::HLSLTree::FScope& Scope, int32 OutputIndex, UE::HLSLTree::FExpression const*& OutExpression) const override;

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/Materials/MaterialExpressionEyeAdaptationInverse.h:5

Scope: file

Source code excerpt:

#include "UObject/ObjectMacros.h"
#include "Materials/MaterialExpression.h"
#include "MaterialExpressionEyeAdaptationInverse.generated.h"

/**
 * Provides access to the EyeAdaptation render target.
 */


UCLASS(collapsecategories, hidecategories=Object)
class UMaterialExpressionEyeAdaptationInverse : public UMaterialExpression
{
	GENERATED_UCLASS_BODY()

	//~ Begin UMaterialExpression Interface
#if WITH_EDITOR
	virtual int32 Compile(class FMaterialCompiler* Compiler, int32 OutputIndex) override;
	virtual void GetCaption(TArray<FString>& OutCaptions) const override;
	virtual bool GenerateHLSLExpression(FMaterialHLSLGenerator& Generator, UE::HLSLTree::FScope& Scope, int32 OutputIndex, UE::HLSLTree::FExpression const*& OutExpression) const override;

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Materials/HLSLMaterialTranslator.cpp:14157

Scope: file

Source code excerpt:

		const bool bEnablePreviousFrameInformation = bCompilingPreviousFrame && bAccurateWindVelocities;
		return AddCodeChunk(MCT_Float3, TEXT("GetSpeedTreeVertexOffset(Parameters, %s, %s, %s, %g, %s, %s, %s)"), *GetParameterCode(GeometryArg), *GetParameterCode(WindArg), *GetParameterCode(LODArg), BillboardThreshold, bEnablePreviousFrameInformation ? TEXT("true") : TEXT("false"), bExtraBend ? TEXT("true") : TEXT("false"), *GetParameterCode(ExtraBendArg, TEXT("float3(0,0,0)")));
	}
}

/**Experimental access to the EyeAdaptation RT for Post Process materials. Can be one frame behind depending on the value of BlendableLocation. */
int32 FHLSLMaterialTranslator::EyeAdaptation()
{
	if( ShaderFrequency != SF_Pixel )
	{
		return NonPixelShaderExpressionError();
	}

	MaterialCompilationOutput.bUsesEyeAdaptation = true;

	return AddInlinedCodeChunkZeroDeriv(MCT_Float, TEXT("EyeAdaptationLookup()"));
}

/**Experimental access to the EyeAdaptation RT for applying an inverse. */
int32 FHLSLMaterialTranslator::EyeAdaptationInverse(int32 LightValueArg, int32 AlphaArg)
{
	if (ShaderFrequency != SF_Pixel)
	{
		return NonPixelShaderExpressionError();
	}

	if (LightValueArg == INDEX_NONE || AlphaArg == INDEX_NONE)
	{
		return INDEX_NONE;
	}

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Materials/HLSLMaterialTranslator.cpp:14170

Scope: file

Source code excerpt:

}

/**Experimental access to the EyeAdaptation RT for applying an inverse. */
int32 FHLSLMaterialTranslator::EyeAdaptationInverse(int32 LightValueArg, int32 AlphaArg)
{
	if (ShaderFrequency != SF_Pixel)
	{
		return NonPixelShaderExpressionError();
	}

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Materials/HLSLMaterialTranslator.h:1349

Scope (from outer to inner):

file
class        class FHLSLMaterialTranslator : public FMaterialCompiler

Source code excerpt:

	*
	* @return	Code index
	*/
	virtual int32 SpeedTree(int32 GeometryArg, int32 WindArg, int32 LODArg, float BillboardThreshold, bool bAccurateWindVelocities, bool bExtraBend, int32 ExtraBendArg) override;

	/**Experimental access to the EyeAdaptation RT for Post Process materials. Can be one frame behind depending on the value of BlendableLocation. */
	virtual int32 EyeAdaptation() override;

	/**Experimental access to the EyeAdaptation RT for applying an inverse. */
	virtual int32 EyeAdaptationInverse(int32 LightValueArg, int32 AlphaArg) override;

	/**
	 * To only have one piece of code dealing with error handling if the Primitive constant buffer is not used.
	 * @param Name e.g. TEXT("ObjectWorldPositionAndRadius.w")
	 */
	int32 GetPrimitiveProperty(EMaterialValueType Type, const TCHAR* ExpressionName, const TCHAR* HLSLName);

	/**
	 * The compiler can run in a different state and this affects caching of sub expression, Expressions are different(e.g.View.PrevWorldViewOrigin) when using previous frame's values.
	 */

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Materials/MaterialExpressionHLSL.cpp:1330

Scope (from outer to inner):

file
function     bool UMaterialExpressionEyeAdaptation::GenerateHLSLExpression

Source code excerpt:

}

bool UMaterialExpressionEyeAdaptation::GenerateHLSLExpression(FMaterialHLSLGenerator& Generator, UE::HLSLTree::FScope& Scope, int32 OutputIndex, UE::HLSLTree::FExpression const*& OutExpression) const
{
	using namespace UE::HLSLTree;
	OutExpression = Generator.GetTree().NewExpression<Material::FExpressionExternalInput>(Material::EExternalInput::EyeAdaptation);
	return true;
}

bool UMaterialExpressionEyeAdaptationInverse::GenerateHLSLExpression(FMaterialHLSLGenerator& Generator, UE::HLSLTree::FScope& Scope, int32 OutputIndex, UE::HLSLTree::FExpression const*& OutExpression) const
{
	using namespace UE::HLSLTree;
	const FExpression* ExpressionLightValue = LightValueInput.AcquireHLSLExpressionOrConstant(Generator, Scope, FVector3f(1.0f, 1.0f, 1.0f));
	const FExpression* ExpressionAlpha = AlphaInput.AcquireHLSLExpressionOrConstant(Generator, Scope, 1.0f);
	if (!ExpressionLightValue || !ExpressionAlpha)
	{
		return false;
	}

	FTree& Tree = Generator.GetTree();
	const FExpression* ExpressionAdaptation = Tree.NewExpression<Material::FExpressionExternalInput>(Material::EExternalInput::EyeAdaptation);
	const FExpression* LerpLogScale = Tree.NewMul(Tree.NewNeg(ExpressionAlpha), Tree.NewLog2(ExpressionAdaptation));
	const FExpression* Scale = Tree.NewExp2(LerpLogScale);
	OutExpression = Tree.NewMul(ExpressionLightValue, Scale);
	return true;
}

bool UMaterialExpressionParticleColor::GenerateHLSLExpression(FMaterialHLSLGenerator& Generator, UE::HLSLTree::FScope& Scope, int32 OutputIndex, UE::HLSLTree::FExpression const*& OutExpression) const
{
	using namespace UE::HLSLTree::Material;
	OutExpression = Generator.GetTree().NewExpression<FExpressionExternalInput>(EExternalInput::ParticleColor);
	return true;

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Materials/MaterialExpressionHLSL.cpp:1345

Scope (from outer to inner):

file
function     bool UMaterialExpressionEyeAdaptationInverse::GenerateHLSLExpression

Source code excerpt:


	FTree& Tree = Generator.GetTree();
	const FExpression* ExpressionAdaptation = Tree.NewExpression<Material::FExpressionExternalInput>(Material::EExternalInput::EyeAdaptation);
	const FExpression* LerpLogScale = Tree.NewMul(Tree.NewNeg(ExpressionAlpha), Tree.NewLog2(ExpressionAdaptation));
	const FExpression* Scale = Tree.NewExp2(LerpLogScale);
	OutExpression = Tree.NewMul(ExpressionLightValue, Scale);
	return true;
}

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Materials/MaterialExpressions.cpp:21800

Scope (from outer to inner):

file
function     UMaterialExpressionEyeAdaptation::UMaterialExpressionEyeAdaptation

Source code excerpt:

	static FConstructorStatics ConstructorStatics;

	MenuCategories.Add(ConstructorStatics.NAME_Utility);

	Outputs.Reset();
	Outputs.Add(FExpressionOutput(TEXT("EyeAdaptation")));
	bShaderInputData = true;
#endif
}

#if WITH_EDITOR
int32 UMaterialExpressionEyeAdaptation::Compile(class FMaterialCompiler* Compiler, int32 OutputIndex)
{    
	return Compiler->EyeAdaptation();
}

void UMaterialExpressionEyeAdaptation::GetCaption(TArray<FString>& OutCaptions) const
{
	OutCaptions.Add(FString(TEXT("EyeAdaptation")));
}
#endif // WITH_EDITOR

///////////////////////////////////////////////////////////////////////////////
// UMaterialExpressionEyeAdaptationInverse
///////////////////////////////////////////////////////////////////////////////
UMaterialExpressionEyeAdaptationInverse::UMaterialExpressionEyeAdaptationInverse(const FObjectInitializer& ObjectInitializer)
	: Super(ObjectInitializer)
{
#if WITH_EDITORONLY_DATA
	// Structure to hold one-time initialization

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Materials/MaterialHLSLEmitter.cpp:1003

Scope (from outer to inner):

file
function     bool MaterialEmitHLSL

Source code excerpt:


	OutCompilationOutput.bModifiesMeshPosition = bUsesPixelDepthOffset || bUsesWorldPositionOffset || bUsesDisplacement;
	OutCompilationOutput.bUsesWorldPositionOffset = bUsesWorldPositionOffset;
	OutCompilationOutput.bUsesPixelDepthOffset = bUsesPixelDepthOffset && AllowPixelDepthOffset(InCompilerTarget.ShaderPlatform);
	OutCompilationOutput.bUsesDisplacement = bUsesDisplacement;
	OutCompilationOutput.bUsesEyeAdaptation = EmitMaterialData.IsExternalInputUsed(SF_Pixel, Material::EExternalInput::EyeAdaptation);

	FStringBuilderMemstack Declarations(Allocator, 32 * 1024);
	CachedTree->GetTypeRegistry().EmitDeclarationsCode(Declarations);

	FStringBuilderMemstack SharedCode(Allocator, 32 * 1024);
	CachedTree->EmitSharedCode(SharedCode);
	EmitContext.EmitDeclarationsCode(SharedCode);
	EmitMaterialData.EmitInterpolatorShader(EmitContext, SharedCode);

	FString MaterialTemplateSource;
	{

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Materials/MaterialHLSLTree.cpp:95

Scope (from outer to inner):

file
namespace    UE::HLSLTree::Material
function     FExternalInputDescription GetExternalInputDescription

Source code excerpt:

	case EExternalInput::TemporalSampleCount: return FExternalInputDescription(TEXT("TemporalSampleCount"), Shader::EValueType::Float1);
	case EExternalInput::TemporalSampleIndex: return FExternalInputDescription(TEXT("TemporalSampleIndex"), Shader::EValueType::Float1);
	case EExternalInput::TemporalSampleOffset: return FExternalInputDescription(TEXT("TemporalSampleOffset"), Shader::EValueType::Float2);
	case EExternalInput::PreExposure: return FExternalInputDescription(TEXT("PreExposure"), Shader::EValueType::Float1);
	case EExternalInput::RcpPreExposure: return FExternalInputDescription(TEXT("RcpPreExposure"), Shader::EValueType::Float1);
	case EExternalInput::EyeAdaptation: return FExternalInputDescription(TEXT("EyeAdaptation"), Shader::EValueType::Float1);
	case EExternalInput::RuntimeVirtualTextureOutputLevel: return FExternalInputDescription(TEXT("RuntimeVirtualTextureOutputLevel"), Shader::EValueType::Float1);
	case EExternalInput::RuntimeVirtualTextureOutputDerivative: return FExternalInputDescription(TEXT("RuntimeVirtualTextureOutputDerivative"), Shader::EValueType::Float2);
	case EExternalInput::RuntimeVirtualTextureMaxLevel: return FExternalInputDescription(TEXT("RuntimeVirtualTextureMaxLevel"), Shader::EValueType::Float1);
	case EExternalInput::ResolutionFraction: return FExternalInputDescription(TEXT("ResolutionFraction"), Shader::EValueType::Float1);
	case EExternalInput::RcpResolutionFraction: return FExternalInputDescription(TEXT("RcpResolutionFraction"), Shader::EValueType::Float1);

	case EExternalInput::CameraVector: return FExternalInputDescription(TEXT("CameraVector"), Shader::EValueType::Float3);
	case EExternalInput::LightVector: return FExternalInputDescription(TEXT("LightVector"), Shader::EValueType::Float3);
	case EExternalInput::CameraWorldPosition: return FExternalInputDescription(TEXT("CameraWorldPosition"), Shader::EValueType::Double3, EExternalInput::None, EExternalInput::None, EExternalInput::PrevCameraWorldPosition);
	case EExternalInput::ViewWorldPosition: return FExternalInputDescription(TEXT("ViewWorldPosition"), Shader::EValueType::Double3, EExternalInput::None, EExternalInput::None, EExternalInput::PrevViewWorldPosition);
	case EExternalInput::PreViewTranslation: return FExternalInputDescription(TEXT("PreViewTranslation"), Shader::EValueType::Double3, EExternalInput::None, EExternalInput::None, EExternalInput::PrevPreViewTranslation);

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Materials/MaterialHLSLTree.cpp:385

Scope (from outer to inner):

file
namespace    UE::HLSLTree::Material
function     void FExpressionExternalInput::EmitValueShader

Source code excerpt:

		case EExternalInput::TemporalSampleCount: Code = TEXT("View.TemporalAAParams.y"); break;
		case EExternalInput::TemporalSampleIndex: Code = TEXT("View.TemporalAAParams.x"); break;
		case EExternalInput::TemporalSampleOffset: Code = TEXT("View.TemporalAAParams.zw"); break;
		case EExternalInput::PreExposure: Code = TEXT("View.PreExposure.x"); break;
		case EExternalInput::RcpPreExposure: Code = TEXT("View.OneOverPreExposure.x"); break;
		case EExternalInput::EyeAdaptation: Code = TEXT("EyeAdaptationLookup()"); break;
		case EExternalInput::RuntimeVirtualTextureOutputLevel:  Code = TEXT("View.RuntimeVirtualTextureMipLevel.x"); break;
		case EExternalInput::RuntimeVirtualTextureOutputDerivative: Code = TEXT("View.RuntimeVirtualTextureMipLevel.zw"); break;
		case EExternalInput::RuntimeVirtualTextureMaxLevel:  Code = TEXT("View.RuntimeVirtualTextureMipLevel.y"); break;
		case EExternalInput::ResolutionFraction: Code = TEXT("View.ResolutionFractionAndInv.x"); break;
		case EExternalInput::RcpResolutionFraction: Code = TEXT("View.ResolutionFractionAndInv.y"); break;

		case EExternalInput::CameraVector: Code = TEXT("Parameters.CameraVector"); break;
		case EExternalInput::LightVector: Code = TEXT("Parameters.LightVector"); break;
		case EExternalInput::CameraWorldPosition: Code = TEXT("GetWorldCameraOrigin(Parameters)"); break;
		case EExternalInput::ViewWorldPosition: Code = TEXT("GetWorldViewOrigin(Parameters)"); break;
		case EExternalInput::PreViewTranslation: Code = TEXT("GetPreViewTranslation(Parameters)"); break;

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/ShowFlags.cpp:632

Scope (from outer to inner):

file
function     void EngineShowFlagOverride

Source code excerpt:

		{
			 int32 Value = ICVar->GetValueOnGameThread();

#define DISABLE_ENGINE_SHOWFLAG(Name) if(Value-- >  0) EngineShowFlags.Set##Name(false);
			 DISABLE_ENGINE_SHOWFLAG(AntiAliasing)
			 DISABLE_ENGINE_SHOWFLAG(EyeAdaptation)
			 DISABLE_ENGINE_SHOWFLAG(SeparateTranslucency)
			 DISABLE_ENGINE_SHOWFLAG(DepthOfField)
			 DISABLE_ENGINE_SHOWFLAG(AmbientOcclusion)
			 DISABLE_ENGINE_SHOWFLAG(CameraImperfections)
			 DISABLE_ENGINE_SHOWFLAG(Decals)
			 DISABLE_ENGINE_SHOWFLAG(LensFlares)
			 DISABLE_ENGINE_SHOWFLAG(Bloom)
			 DISABLE_ENGINE_SHOWFLAG(ColorGrading)
			 DISABLE_ENGINE_SHOWFLAG(Tonemapper)
			 DISABLE_ENGINE_SHOWFLAG(Refraction)
			 DISABLE_ENGINE_SHOWFLAG(ReflectionEnvironment)

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/MaterialCompiler.h:538

Scope (from outer to inner):

file
class        class FMaterialCompiler

Source code excerpt:

	{
		return AtmosphericFogColor(WorldPosition, EPositionOrigin::Absolute);
	}
	virtual int32 RotateScaleOffsetTexCoords(int32 TexCoordCodeIndex, int32 RotationScale, int32 Offset) = 0;
	virtual int32 SpeedTree(int32 GeometryArg, int32 WindArg, int32 LODArg, float BillboardThreshold, bool bAccurateWindVelocities, bool bExtraBend, int32 ExtraBendArg) = 0;
	virtual int32 EyeAdaptation() = 0;
	virtual int32 EyeAdaptationInverse(int32 LightValueArg, int32 AlphaArg) = 0;
	virtual int32 AtmosphericLightVector() = 0;
	virtual int32 AtmosphericLightColor() = 0;

	virtual int32 SkyAtmosphereLightIlluminance(int32 WorldPosition, EPositionOrigin PositionOrigin, int32 LightIndex) = 0;
	UE_DEPRECATED(5.4, "Use SkyAtmosphereLightIlluminance(int32, EPositionOrigin, int32) instead")
	int32 SkyAtmosphereLightIlluminance(int32 WorldPosition, int32 LightIndex)
	{
		return SkyAtmosphereLightIlluminance(WorldPosition, EPositionOrigin::Absolute, LightIndex);
	}
	virtual int32 SkyAtmosphereLightIlluminanceOnGround(int32 LightIndex) = 0;

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/MaterialCompiler.h:1169

Scope (from outer to inner):

file
class        class FProxyMaterialCompiler : public FMaterialCompiler
function     virtual int32 EyeAdaptation

Source code excerpt:

	virtual int32 MapARPassthroughCameraUV(int32 UV) override
	{
		return Compiler->MapARPassthroughCameraUV(UV);
	}

	virtual int32 EyeAdaptation() override
	{
		return Compiler->EyeAdaptation();
	}

	virtual int32 EyeAdaptationInverse(int32 LightValueArg, int32 AlphaArg) override
	{
		return Compiler->EyeAdaptationInverse(LightValueArg, AlphaArg);
	}

	virtual bool IsDevelopmentFeatureEnabled(const FName& FeatureName) const override
	{
		return Compiler->IsDevelopmentFeatureEnabled(FeatureName);
	}

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/MaterialHLSLTree.h:130

Scope (from outer to inner):

file
namespace    UE::HLSLTree::Material

Source code excerpt:

	TemporalSampleCount,
	TemporalSampleIndex,
	TemporalSampleOffset,
	PreExposure,
	RcpPreExposure,
	EyeAdaptation,
	RuntimeVirtualTextureOutputLevel,
	RuntimeVirtualTextureOutputDerivative,
	RuntimeVirtualTextureMaxLevel,
	ResolutionFraction,
	RcpResolutionFraction,

	CameraVector,
	LightVector,
	CameraWorldPosition,
	ViewWorldPosition,
	PreViewTranslation,

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/ShowFlags.h:302

Scope: file

Source code excerpt:

	 * @return true:success, false:parse error detected
	 */
	ENGINE_API bool SetFromString(const TCHAR* In);
	
	/**
	 * @param Name e.g. TEXT("EyeAdaptation")
	 * @param CommaSeparatedNames leave 0 for normal purpose, is used internally for the grouping feature
	 * @return -1 if not found
	 */
	ENGINE_API static int32 FindIndexByName(const TCHAR* Name, const TCHAR *CommaSeparatedNames = 0);
	
	/**
	 * @param Name e.g. TEXT("EyeAdaptation")
	 * @param CommaSeparatedNames leave 0 for normal purpose, is used internally for the grouping feature
	 * @return success
	 */
	static inline bool IsNameThere(const TCHAR* Name, const TCHAR *CommaSeparatedNames)
	{
		return FindIndexByName(Name, CommaSeparatedNames) != -1;
	}

	/**
	 * @param InIndex can be from FindIndexByName() or IterateAllFlags()
	 * @return empty string if not found, otherwise name of the flag e.g. FString(TEXT("PostProcessing"))
	 */
	ENGINE_API static FString FindNameByIndex(uint32 InIndex);
	
	/**

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/ShowFlagsValues.inl:30

Scope: file

Source code excerpt:

/** Only used in AntiAliasing is on, true:uses Temporal AA, otherwise FXAA, for now SHOWFLAG_ALWAYS_ACCESSIBLE because it's exposed in SceneCapture  */
SHOWFLAG_ALWAYS_ACCESSIBLE(TemporalAA, SFG_Advanced, NSLOCTEXT("UnrealEd", "TemporalAASF", "Temporal AA (instead FXAA)"))
/** e.g. Ambient cube map, for now SHOWFLAG_ALWAYS_ACCESSIBLE because it's exposed in SceneCapture */
SHOWFLAG_ALWAYS_ACCESSIBLE(AmbientCubemap, SFG_LightingFeatures, NSLOCTEXT("UnrealEd", "AmbientCubemapSF", "Ambient Cubemap"))
/** Human like eye simulation to adapt to the brightness of the view, for now SHOWFLAG_ALWAYS_ACCESSIBLE because it's exposed in SceneCapture */
SHOWFLAG_ALWAYS_ACCESSIBLE(EyeAdaptation, SFG_PostProcess, NSLOCTEXT("UnrealEd", "EyeAdaptationSF", "Eye Adaptation"))
/** Display a histogram of the scene HDR color */
SHOWFLAG_FIXED_IN_SHIPPING(0, VisualizeHDR, SFG_Visualize, NSLOCTEXT("UnrealEd", "VisualizeHDRSF", "HDR (Eye Adaptation)"))
/** Display the illuminance debug view for the skylight */
SHOWFLAG_FIXED_IN_SHIPPING(0, VisualizeSkyLightIlluminance, SFG_Visualize, NSLOCTEXT("UnrealEd", "VisualizeSkyLightIlluminance", "Visualize SkyLight Illuminance"))
/** Helper to tweak local expsoure settings */
SHOWFLAG_FIXED_IN_SHIPPING(0, VisualizeLocalExposure, SFG_Visualize, NSLOCTEXT("UnrealEd", "VisualizeLocalExposureSF", "Local Exposure"))
/** Image based lens flares (Simulate artifact of reflections within a camera system) */
SHOWFLAG_FIXED_IN_SHIPPING(1, LensFlares, SFG_PostProcess, NSLOCTEXT("UnrealEd", "LensFlaresSF", "Lens Flares"))
/** show indirect lighting component, for now SHOWFLAG_ALWAYS_ACCESSIBLE because it's needed by r.GBuffer */
SHOWFLAG_ALWAYS_ACCESSIBLE(GlobalIllumination, SFG_LightingComponents, NSLOCTEXT("UnrealEd", "GlobalIlluminationSF", "Global Illumination"))
/** Darkens the screen borders (Camera artifact and artistic effect) */

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

Scope (from outer to inner):

file
function     void FDeferredShadingSceneRenderer::RenderDiffuseIndirectAndAmbientOcclusion
lambda-function

Source code excerpt:

				PassParameters->CompressedMetadata[0] = CompressedMetadataPlaceholder;
				PassParameters->CompressedMetadata[1] = CompressedMetadataPlaceholder;
			}

			PassParameters->BufferUVToOutputPixelPosition = BufferExtent;
			PassParameters->EyeAdaptation = GraphBuilder.CreateSRV(GetEyeAdaptationBuffer(GraphBuilder, View));
			LumenReflections::SetupCompositeParameters(View, PassParameters->ReflectionsCompositeParameters);
			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/PostProcess/PostProcessBloomSetup.cpp:33

Scope (from outer to inner):

file
namespace    anonymous

Source code excerpt:

	SHADER_PARAMETER_SAMPLER(SamplerState, LumBilateralGridSampler)
	SHADER_PARAMETER_RDG_TEXTURE(Texture2D, BlurredLogLum)
	SHADER_PARAMETER_SAMPLER(SamplerState, BlurredLogLumSampler)
	SHADER_PARAMETER_STRUCT(FLocalExposureParameters, LocalExposure)
	SHADER_PARAMETER_RDG_BUFFER_SRV(StructuredBuffer<float4>, EyeAdaptationBuffer)
	SHADER_PARAMETER_STRUCT(FEyeAdaptationParameters, EyeAdaptation)
	SHADER_PARAMETER(float, BloomThreshold)
END_SHADER_PARAMETER_STRUCT()

FBloomSetupParameters GetBloomSetupParameters(
	FRDGBuilder& GraphBuilder,
	const FViewInfo& View,
	const FScreenPassTextureViewport& InputViewport,
	const FBloomSetupInputs& Inputs)
{
	FBloomSetupParameters Parameters;
	Parameters.View = View.ViewUniformBuffer;

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessBloomSetup.cpp:54

Scope (from outer to inner):

file
namespace    anonymous
function     FBloomSetupParameters GetBloomSetupParameters

Source code excerpt:

	Parameters.LumBilateralGridSampler = TStaticSamplerState<SF_Bilinear, AM_Clamp, AM_Clamp, AM_Clamp>::GetRHI();
	Parameters.BlurredLogLum = Inputs.BlurredLogLuminanceTexture;
	Parameters.BlurredLogLumSampler = TStaticSamplerState<SF_Bilinear, AM_Clamp, AM_Clamp, AM_Clamp>::GetRHI();
	Parameters.LocalExposure = *Inputs.LocalExposureParameters;
	Parameters.EyeAdaptationBuffer = GraphBuilder.CreateSRV(Inputs.EyeAdaptationBuffer);
	Parameters.EyeAdaptation = *Inputs.EyeAdaptationParameters;
	Parameters.BloomThreshold = Inputs.Threshold;
	return Parameters;
}

class FBloomSetupPS : public FGlobalShader
{
public:
	DECLARE_GLOBAL_SHADER(FBloomSetupPS);
	SHADER_USE_PARAMETER_STRUCT(FBloomSetupPS, FGlobalShader);

	class FLocalExposureDim : SHADER_PERMUTATION_BOOL("USE_LOCAL_EXPOSURE");

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessEyeAdaptation.cpp:278

Scope (from outer to inner):

file
function     EAutoExposureMethod GetAutoExposureMethod

Source code excerpt:

	{
		AutoExposureMethod = OverrideAutoExposureMethod;
	}

	// If auto exposure is disabled, revert to manual mode which will clamp to a reasonable default.
	if (!View.Family->EngineShowFlags.EyeAdaptation)
	{
		AutoExposureMethod = AEM_Manual;
	}

	return AutoExposureMethod;
}

float GetAutoExposureCompensationFromSettings(const FViewInfo& View)
{
	const FPostProcessSettings& Settings = View.FinalPostProcessSettings;

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessEyeAdaptation.cpp:423

Scope (from outer to inner):

file
function     FEyeAdaptationParameters GetEyeAdaptationParameters

Source code excerpt:


		// ignores bExtendedLuminanceRange
		MinWhitePointLuminance = MaxWhitePointLuminance = CalculateFixedAutoExposure(View);
	}
	// The feature level check should always pass unless on mobile with MobileHDR is false
	else if (EngineShowFlags.EyeAdaptation && View.GetFeatureLevel() >= GetBasicEyeAdaptationMinFeatureLevel())
	{
		if (AutoExposureMethod == EAutoExposureMethod::AEM_Manual)
		{
			// ignores bExtendedLuminanceRange
			MinWhitePointLuminance = MaxWhitePointLuminance = CalculateManualAutoExposure(View, false);
		}
		else
		{
			if (bExtendedLuminanceRange)
			{
				MinWhitePointLuminance = EV100ToLuminance(LuminanceMax, Settings.AutoExposureMinBrightness);

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessEyeAdaptation.cpp:687

Scope (from outer to inner):

file
function     FRDGTextureRef AddSetupExposureIlluminancePass

Source code excerpt:

			PassParameters->View = View.ViewUniformBuffer;
			PassParameters->SceneTextures = GetSceneTextureParameters(GraphBuilder, SceneTextures);
			PassParameters->ColorTexture = SceneTextures.Color.Resolve;
			PassParameters->RWIlluminanceTexture = GraphBuilder.CreateUAV(OutputTexture);
			PassParameters->Illuminance = GetScreenPassTextureViewportParameters(OutputViewport);
			PassParameters->EyeAdaptation = GetEyeAdaptationParameters(View);
			PassParameters->IllumiananceDownscaleFactor = GetAutoExposureIlluminanceDownscaleFactor();

			auto ComputeShader = View.ShaderMap->GetShader<FSetupExposureIlluminanceCS>();

			FComputeShaderUtils::AddPass(
				GraphBuilder,
				RDG_EVENT_NAME("SetupExposureIlluminance (ViewId=%d)", ViewIndex),
				ComputeShader,
				PassParameters,
				FComputeShaderUtils::GetGroupCount(OutputViewport.Rect.Size(), FIntPoint(8, 8)));
		}

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessEyeAdaptation.cpp:767

Scope (from outer to inner):

file
function     FRDGTextureRef AddCalculateExposureIlluminancePass

Source code excerpt:

			PassParameters->SceneTextures = GetSceneTextureParameters(GraphBuilder, SceneTextures);
			PassParameters->ColorTexture = SceneTextures.Color.Resolve;
			PassParameters->RWIlluminanceTexture = GraphBuilder.CreateUAV(ExposureIlluminanceSetup);
			PassParameters->Illuminance = GetScreenPassTextureViewportParameters(OutputViewport);
			PassParameters->IllumiananceDownscaleFactor = GetAutoExposureIlluminanceDownscaleFactor();
			PassParameters->EyeAdaptation = GetEyeAdaptationParameters(View);

			PassParameters->PreIntegratedGF = GSystemTextures.PreintegratedGF->GetRHI();
			PassParameters->PreIntegratedGFSampler = TStaticSamplerState<SF_Bilinear, AM_Clamp, AM_Clamp, AM_Clamp>::GetRHI();

			PassParameters->TranslucencyLightingVolume = GetTranslucencyLightingVolumeParameters(GraphBuilder, TranslucencyLightingVolumeTextures, View);

			auto* LumenUniforms = GraphBuilder.AllocParameters<FLumenTranslucencyLightingUniforms>();
			LumenUniforms->Parameters = GetLumenTranslucencyLightingParameters(GraphBuilder, View.GetLumenTranslucencyGIVolume(), View.LumenFrontLayerTranslucency);
			PassParameters->LumenGIVolumeStruct = GraphBuilder.CreateUniformBuffer(LumenUniforms);
			PassParameters->Substrate = Substrate::BindSubstrateGlobalUniformParameters(View);

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessEyeAdaptation.cpp:836

Scope (from outer to inner):

file
function     FRDGBufferRef AddHistogramEyeAdaptationPass

Source code excerpt:

	View.SwapEyeAdaptationBuffers();

	FRDGBufferRef OutputBuffer = GraphBuilder.RegisterExternalBuffer(View.GetEyeAdaptationBuffer(GraphBuilder), ERDGBufferFlags::MultiFrame);

	FEyeAdaptationCS::FParameters* PassParameters = GraphBuilder.AllocParameters<FEyeAdaptationCS::FParameters>();
	PassParameters->EyeAdaptation = EyeAdaptationParameters;
	PassParameters->LocalExposure = LocalExposureParameters;
	PassParameters->HistogramTexture = HistogramTexture;
	PassParameters->RWEyeAdaptationBuffer = GraphBuilder.CreateUAV(OutputBuffer);

	FEyeAdaptationCS::FPermutationDomain PermutationVector;
	PermutationVector.Set<FEyeAdaptationCS::FComputeAverageLocalExposure>(bComputeAverageLocalExposure);

	auto ComputeShader = View.ShaderMap->GetShader<FEyeAdaptationCS>(PermutationVector);

	FComputeShaderUtils::AddPass(
		GraphBuilder,

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessEyeAdaptation.cpp:902

Scope (from outer to inner):

file
function     FScreenPassTexture AddBasicEyeAdaptationSetupPass

Source code excerpt:


	FRDGTextureDesc OutputDesc = SceneColor.Texture->Desc;
	OutputDesc.Reset();
	// Require alpha channel for log2 information.
	OutputDesc.Format = PF_FloatRGBA;
	OutputDesc.Flags |= GFastVRamConfig.EyeAdaptation;

	FRDGTextureRef OutputTexture = GraphBuilder.CreateTexture(OutputDesc, TEXT("BasicEyeAdaptationSetup"));

	const FScreenPassTextureViewport Viewport(SceneColor);

	FBasicEyeAdaptationSetupPS::FParameters* PassParameters = GraphBuilder.AllocParameters<FBasicEyeAdaptationSetupPS::FParameters>();
	PassParameters->View = View.ViewUniformBuffer;
	PassParameters->EyeAdaptation = EyeAdaptationParameters;
	PassParameters->ColorTexture = SceneColor.Texture;
	PassParameters->ColorSampler = TStaticSamplerState<SF_Point, AM_Clamp, AM_Clamp, AM_Clamp>::GetRHI();
	PassParameters->RenderTargets[0] = FRenderTargetBinding(OutputTexture, View.GetOverwriteLoadAction());

	TShaderMapRef<FBasicEyeAdaptationSetupPS> PixelShader(View.ShaderMap);

	AddDrawScreenPass(
		GraphBuilder,
		RDG_EVENT_NAME("BasicEyeAdaptationSetup (PS) %dx%d", Viewport.Rect.Width(), Viewport.Rect.Height()),
		View,
		Viewport,

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessEyeAdaptation.cpp:975

Scope (from outer to inner):

file
function     FRDGBufferRef AddBasicEyeAdaptationPass

Source code excerpt:


	FRDGBufferRef OutputBuffer = GraphBuilder.RegisterExternalBuffer(View.GetEyeAdaptationBuffer(GraphBuilder), ERDGBufferFlags::MultiFrame);

	FBasicEyeAdaptationCS::FParameters* PassParameters = GraphBuilder.AllocParameters<FBasicEyeAdaptationCS::FParameters>();
	PassParameters->View = View.ViewUniformBuffer;
	PassParameters->EyeAdaptation = EyeAdaptationParameters;
	PassParameters->LocalExposure = LocalExposureParameters;
	PassParameters->Color = GetScreenPassTextureViewportParameters(SceneColorViewport);
	PassParameters->ColorTexture = SceneColor.TextureSRV;
	PassParameters->EyeAdaptationBuffer = GraphBuilder.CreateSRV(EyeAdaptationBuffer);
	PassParameters->RWEyeAdaptationBuffer = GraphBuilder.CreateUAV(OutputBuffer);

	FBasicEyeAdaptationCS::FPermutationDomain PermutationVector;
	PermutationVector.Set<FBasicEyeAdaptationCS::FComputeAverageLocalExposure>(bComputeAverageLocalExposure);

	auto ComputeShader = View.ShaderMap->GetShader<FBasicEyeAdaptationCS>(PermutationVector);

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessEyeAdaptation.cpp:1191

Scope (from outer to inner):

file
function     void FViewInfo::UpdatePreExposure

Source code excerpt:

	// One could use the IsRichView functionality to check if we need to update pre-exposure, 
	// but this is too limiting for certain view. For instance shader preview doesn't have 
	// volumetric lighting enabled, which makes the view be flagged as rich, and not updating 
	// the pre-exposition value.
	const bool bIsPreExposureRelevant = true
		&& ViewFamily.EngineShowFlags.EyeAdaptation // Controls whether scene luminance is computed at all.
		&& ViewFamily.EngineShowFlags.Lighting
		&& bIsPostProcessingEnabled
		&& ViewFamily.bResolveScene
		&& !ViewFamily.EngineShowFlags.LightMapDensity
		&& !ViewFamily.EngineShowFlags.StationaryLightOverlap
		&& !ViewFamily.EngineShowFlags.LightComplexity
		&& !ViewFamily.EngineShowFlags.LODColoration
		&& !ViewFamily.EngineShowFlags.HLODColoration
		&& !ViewFamily.EngineShowFlags.ActorColoration
		&& ((!ViewFamily.EngineShowFlags.VisualizeBuffer) || CurrentBufferVisualizationMode != NAME_None) // disable pre-exposure for the buffer visualization modes
		&& !ViewFamily.EngineShowFlags.RayTracingDebug;

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessHistogram.cpp:270

Scope (from outer to inner):

file
function     static FRDGTextureRef AddHistogramLegacyPass

Source code excerpt:

		PassParameters->Input = GetScreenPassTextureViewportParameters(FScreenPassTextureViewport(SceneColor));
		PassParameters->InputSampler = TStaticSamplerState<SF_Point, AM_Clamp, AM_Clamp, AM_Clamp>::GetRHI();
		PassParameters->InputTexture = SceneColor.TextureSRV;
		PassParameters->HistogramRWTexture = GraphBuilder.CreateUAV(HistogramTexture);
		PassParameters->ThreadGroupCount = HistogramThreadGroupCount;
		PassParameters->EyeAdaptation = EyeAdaptationParameters;

		{
			const FRDGTextureDesc Desc = FRDGTextureDesc::Create2D(SceneColor.ViewRect.Size(), PF_R16F, FClearValueBinding::Black, TexCreate_UAV | TexCreate_ShaderResource);
			FRDGTextureRef DebugOutputTexture = GraphBuilder.CreateTexture(Desc, TEXT("EyeAdaptation_DebugOutput"));
			PassParameters->DebugOutput = GraphBuilder.CreateUAV(DebugOutputTexture);
		}

		FHistogramCS::FPermutationDomain PermutationVector;
		PermutationVector.Set<AutoExposurePermutation::FCommonDomain>(AutoExposurePermutation::BuildCommonPermutationDomain());

		auto ComputeShader = View.ShaderMap->GetShader<FHistogramCS>(PermutationVector);

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessHistogram.cpp:374

Scope (from outer to inner):

file
function     static FRDGTextureRef AddHistogramAtomicPass

Source code excerpt:

		PassParameters->SceneTextures = SceneTextures;
		PassParameters->Input = GetScreenPassTextureViewportParameters(FScreenPassTextureViewport(SceneColor));
		PassParameters->InputTexture = SceneColor.TextureSRV;
		PassParameters->EyeAdaptationBuffer = GraphBuilder.CreateSRV(EyeAdaptationBuffer);
		PassParameters->ThreadGroupCount = FIntPoint(SceneColor.ViewRect.Size().Y, 1);
		PassParameters->EyeAdaptation = EyeAdaptationParameters;
		// PassParameters->HistogramScatter64Output = GraphBuilder->CreateUAV(HistogramScatter64Texture);
		PassParameters->HistogramScatter32Output = GraphBuilder.CreateUAV(HistogramScatter32Texture);

		{
			const FRDGTextureDesc Desc = FRDGTextureDesc::Create2D(SceneColor.ViewRect.Size(), PF_R16F, FClearValueBinding::Black, TexCreate_UAV | TexCreate_ShaderResource);
			FRDGTextureRef DebugOutputTexture = GraphBuilder.CreateTexture(Desc, TEXT("EyeAdaptation_DebugOutput"));
			PassParameters->DebugOutput = GraphBuilder.CreateUAV(DebugOutputTexture);
		}

		PassParameters->PreIntegratedGF = GSystemTextures.PreintegratedGF->GetRHI();
		PassParameters->PreIntegratedGFSampler = TStaticSamplerState<SF_Bilinear, AM_Clamp, AM_Clamp, AM_Clamp>::GetRHI();

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessHistogram.cpp:508

Scope (from outer to inner):

file
function     FRDGTextureRef AddLocalExposurePass

Source code excerpt:


		LocalExposureTexture = GraphBuilder.CreateTexture(TextureDesc, TEXT("LocalExposure"));

		auto* PassParameters = GraphBuilder.AllocParameters<FHistogramCS::FParameters>();
		PassParameters->View = View.ViewUniformBuffer;
		PassParameters->EyeAdaptation = EyeAdaptationParameters;
		PassParameters->Input = GetScreenPassTextureViewportParameters(FScreenPassTextureViewport(SceneColor));
		PassParameters->InputSampler = TStaticSamplerState<SF_Point, AM_Clamp, AM_Clamp, AM_Clamp>::GetRHI();
		PassParameters->InputTexture = SceneColor.TextureSRV;
		PassParameters->BilateralGridRWTexture = GraphBuilder.CreateUAV(LocalExposureTexture);
		PassParameters->ThreadGroupCount = ThreadGroupCount;

		FHistogramCS::FPermutationDomain PermutationVector;
		PermutationVector.Set<FHistogramCS::FBilateralGrid>(true);

		auto ComputeShader = View.ShaderMap->GetShader<FHistogramCS>(PermutationVector);

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessLocalExposure.cpp:165

Scope (from outer to inner):

file
function     FRDGTextureRef AddLocalExposureBlurredLogLuminancePass

Source code excerpt:


		GaussianLumSetupTexture = GraphBuilder.CreateTexture(TextureDesc, TEXT("GaussianLumSetupTexture"));

		auto* PassParameters = GraphBuilder.AllocParameters<FSetupLogLuminanceCS::FParameters>();
		PassParameters->View = View.ViewUniformBuffer;
		PassParameters->EyeAdaptation = EyeAdaptationParameters;
		PassParameters->Input = GetScreenPassTextureViewportParameters(FScreenPassTextureViewport(InputTexture));
		PassParameters->InputTexture = InputTexture.TextureSRV;
		PassParameters->OutputFloat = GraphBuilder.CreateUAV(GaussianLumSetupTexture);

		FComputeShaderUtils::AddPass(
			GraphBuilder,
			RDG_EVENT_NAME("SetupLogLuminance %dx%d", GaussianLumSetupTexture->Desc.Extent.X, GaussianLumSetupTexture->Desc.Extent.Y),
			ERDGPassFlags::Compute,
			View.ShaderMap->GetShader<FSetupLogLuminanceCS>(),
			PassParameters,
			FComputeShaderUtils::GetGroupCount(GaussianLumSetupTexture->Desc.Extent, FIntPoint(FSetupLogLuminanceCS::ThreadGroupSizeX, FSetupLogLuminanceCS::ThreadGroupSizeY)));

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessLocalExposure.cpp:232

Scope (from outer to inner):

file
function     void AddApplyLocalExposurePass

Source code excerpt:

		}

		PassParameters->OutputFloat4 = GraphBuilder.CreateUAV(OutputDesc);
	}

	PassParameters->EyeAdaptation = EyeAdaptationParameters;
	PassParameters->EyeAdaptationBuffer = GraphBuilder.CreateSRV(EyeAdaptationBuffer);

	PassParameters->LocalExposure = LocalExposureParamaters;
	PassParameters->LumBilateralGrid = LocalExposureTexture;
	PassParameters->BlurredLogLum = BlurredLogLuminanceTexture;

	PassParameters->TextureSampler = TStaticSamplerState<SF_Bilinear, AM_Clamp, AM_Clamp, AM_Clamp>::GetRHI();;

	FComputeShaderUtils::AddPass(
		GraphBuilder,
		RDG_EVENT_NAME("ApplyLocalExposure %dx%d", Output.ViewRect.Width(), Output.ViewRect.Height()),

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessMobile.cpp:51

Scope (from outer to inner):

file
function     bool IsMobileEyeAdaptationEnabled

Source code excerpt:

	return View.FinalPostProcessSettings.DepthOfFieldScale;
}

bool IsMobileEyeAdaptationEnabled(const FViewInfo& View)
{
	return View.ViewState != nullptr && View.Family->EngineShowFlags.EyeAdaptation && CVarMobileEyeAdaptation.GetValueOnRenderThread() == 1 && IsMobileHDR();
}

//Following variations are always generated
// 1 = Bloom
// 3 = Bloom + SunShaft
// 5 = Bloom + Dof
// 7 = Bloom + Dof + SunShaft
// 9 = Bloom + EyeAdaptation
// 11 = Bloom + SunShaft + EyeAdaptation
// 13 = Bloom + Dof + EyeAdaptation
// 15 = Bloom + SunShaft + Dof + EyeAdaptation
// 8 = EyeAdaptation

//Following variations should only be generated on IOS, only IOS has to do PreTonemapMSAA if MSAA is enabled.
// 17 = Bloom + MetalMSAAHDRDecode
// 21 = Bloom + Dof + MetalMSAAHDRDecode
// 25 = Bloom + EyeAdaptation + MetalMSAAHDRDecode
// 29 = Bloom + Dof + EyeAdaptation + MetalMSAAHDRDecode

//Following variations are rare cases, depends on CVarMobileSupportBloomSetupRareCases
// 2 = SunShaft
// 4 = Dof
// 6 = SunShaft + Dof

// 10 = SunShaft + EyeAdaptation
// 12 = Dof + EyeAdaptation
// 14 = SunShaft + Dof + EyeAdaptation

// 20 = Dof + MetalMSAAHDRDecode
// 24 = EyeAdaptation + MetalMSAAHDRDecode
// 28 = Dof + EyeAdaptation + MetalMSAAHDRDecode

//Any variations with SunShaft + MetalMSAAHDRDecode should be not generated, because SceneColor has been decoded at SunMask pass
// 19 = Bloom + SunShaft + MetalMSAAHDRDecode
// 23 = Bloom + Dof + SunShaft + MetalMSAAHDRDecode
// 27 = Bloom + SunShaft + EyeAdaptation + MetalMSAAHDRDecode
// 31 = Bloom + SunShaft + Dof + EyeAdaptation + MetalMSAAHDRDecode

// 18 = SunShaft + MetalMSAAHDRDecode
// 22 = Dof + SunShaft + MetalMSAAHDRDecode
// 26 = SunShaft + EyeAdaptation + MetalMSAAHDRDecode
// 30 = SunShaft + Dof + EyeAdaptation + MetalMSAAHDRDecode


// Remove the variation from this list if it should not be a rare case or enable the CVarMobileSupportBloomSetupRareCases for full cases.
bool IsValidBloomSetupVariation(uint32 Variation)
{
	bool bIsRareCases =
		Variation == 2 ||
		Variation == 4 ||
		Variation == 6 ||

		Variation == 10 ||

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessMobile.cpp:128

Scope: file

Source code excerpt:


enum class EBloomSetupOutputType : uint32
{
	Bloom = 1 << 0,
	SunShaftAndDof = 1 << 1,
	EyeAdaptation = 1 << 2,
};

const TCHAR* GetBloomSetupOutputTypeName(EBloomSetupOutputType BloomSetupOutputType)
{
	switch (BloomSetupOutputType)
	{
	case EBloomSetupOutputType::Bloom : return TEXT("BloomSetup_Bloom");
	case EBloomSetupOutputType::SunShaftAndDof: return TEXT("BloomSetup_SunShaftAndDof");
	case EBloomSetupOutputType::EyeAdaptation: return TEXT("BloomSetup_EyeAdaptation");
	default: return TEXT("Unknown");
	}
}

TArray<EBloomSetupOutputType> GetBloomSetupOutputType(bool bUseBloom, bool bUseSun, bool bUseDof, bool bUseEyeAdaptation)
{
	bool bValidVariation = IsValidBloomSetupVariation(bUseBloom, bUseSun, bUseDof, bUseEyeAdaptation);

	TArray<EBloomSetupOutputType> BloomSetupOutputType;

	//if the variation is invalid, always use bloom permutation

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessMobile.cpp:161

Scope (from outer to inner):

file
function     TArray<EBloomSetupOutputType> GetBloomSetupOutputType

Source code excerpt:

		BloomSetupOutputType.Add(EBloomSetupOutputType::SunShaftAndDof);
	}

	if (bUseEyeAdaptation)
	{
		BloomSetupOutputType.Add(EBloomSetupOutputType::EyeAdaptation);
	}

	checkSlow(BloomSetupOutputType.Num() != 0);

	return MoveTemp(BloomSetupOutputType);
}

//
// BLOOM SETUP
//

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessMobile.cpp:330

Scope (from outer to inner):

file
function     FMobileBloomSetupOutputs AddMobileBloomSetupPass

Source code excerpt:

	for (int32 i = 0; i < BloomSetupOutputType.Num(); ++i)
	{
		PSShaderParameters->RenderTargets[i] = DestRenderTargets[i].GetRenderTargetBinding();
	}

	PSShaderParameters->EyeAdaptation = EyeAdaptationParameters;
	PSShaderParameters->BloomThreshold = View.FinalPostProcessSettings.BloomThreshold;
	PSShaderParameters->View = View.ViewUniformBuffer;

	PSShaderParameters->SceneColorTexture = Inputs.SceneColor.Texture;
	PSShaderParameters->SceneColorSampler = TStaticSamplerState<SF_Bilinear, AM_Clamp, AM_Clamp, AM_Clamp>::GetRHI();

	PSShaderParameters->SunShaftAndDofTexture = Inputs.SunShaftAndDof.Texture;
	PSShaderParameters->SunShaftAndDofSampler = TStaticSamplerState<SF_Bilinear, AM_Clamp, AM_Clamp, AM_Clamp>::GetRHI();

	const FScreenPassTextureViewport InputViewport(Inputs.SceneColor);
	const FScreenPassTextureViewport OutputViewport(DestRenderTargets[0]);

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessMobile.cpp:392

Scope (from outer to inner):

file
function     FMobileBloomSetupOutputs AddMobileBloomSetupPass

Source code excerpt:

		}
		else if(BloomSetupOutputType[i] == EBloomSetupOutputType::SunShaftAndDof)
		{
			Outputs.SunShaftAndDof = DestRenderTargets[i];
		}
		else if (BloomSetupOutputType[i] == EBloomSetupOutputType::EyeAdaptation)
		{
			Outputs.EyeAdaptation = DestRenderTargets[i];
		}
	}

	return MoveTemp(Outputs);
}


//
// BLOOM DOWNSAMPLE
//

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessMobile.cpp:1842

Scope (from outer to inner):

file
function     FMobileEyeAdaptationSetupOutputs AddMobileEyeAdaptationSetupPass

Source code excerpt:

		FMobileAverageLuminanceCS::FParameters* PassParameters = GraphBuilder.AllocParameters<FMobileAverageLuminanceCS::FParameters>();

		PassParameters->SourceSizeAndInvSize = FVector4f(BufferSize.X, BufferSize.Y, 1.0f / BufferSize.X, 1.0f / BufferSize.Y);
		PassParameters->InputSampler = TStaticSamplerState<SF_Bilinear, AM_Clamp, AM_Clamp, AM_Clamp>::GetRHI();
		PassParameters->InputTexture = Inputs.BloomSetup_EyeAdaptation.Texture;
		PassParameters->EyeAdaptation = EyeAdaptationParameters;
		PassParameters->OutputUIntBuffer = EyeAdaptationSetupBufferUAV;

		TShaderMapRef<FMobileAverageLuminanceCS> ComputeShader(View.ShaderMap);

		FComputeShaderUtils::AddPass(
			GraphBuilder,
			RDG_EVENT_NAME("EyeAdaptation_AverageLuminance (CS)"),
			ComputeShader,
			PassParameters,
			FComputeShaderUtils::GetGroupCount(BufferSize, FMobileAverageLuminanceCS::TexelsPerThreadGroup));
	}

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessMobile.cpp:1863

Scope (from outer to inner):

file
function     FMobileEyeAdaptationSetupOutputs AddMobileEyeAdaptationSetupPass

Source code excerpt:

		PassParameters->View = View.ViewUniformBuffer;
		PassParameters->SourceSizeAndInvSize = FVector4f(BufferSize.X, BufferSize.Y, 1.0f / BufferSize.X, 1.0f / BufferSize.Y);
		PassParameters->InputTexture = Inputs.BloomSetup_EyeAdaptation.Texture;
		PassParameters->InputSampler = TStaticSamplerState<SF_Bilinear, AM_Clamp, AM_Clamp, AM_Clamp>::GetRHI();
		PassParameters->RWHistogramBuffer = EyeAdaptationSetupBufferUAV;
		PassParameters->EyeAdaptation = EyeAdaptationParameters;

		bool LowSharedComputeMemory = (GetMaxComputeSharedMemory() < (1 << 15));

		if (LowSharedComputeMemory)
		{
			TShaderMapRef<TMobileHistogramCS<true>> ComputeShader(View.ShaderMap);

			FComputeShaderUtils::AddPass(
				GraphBuilder,
				RDG_EVENT_NAME("EyeAdaptation_Histogram (CS)"),
				ComputeShader,

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessMobile.cpp:1975

Scope (from outer to inner):

file
function     void AddMobileEyeAdaptationPass

Source code excerpt:


	if (Inputs.bUseBasicEyeAdaptation)
	{
		FMobileBasicEyeAdaptationCS::FParameters* PassParameters = GraphBuilder.AllocParameters<FMobileBasicEyeAdaptationCS::FParameters>();

		PassParameters->EyeAdaptation = EyeAdaptationParameters;
		PassParameters->View = View.ViewUniformBuffer;
		PassParameters->EyeAdaptationBuffer = EyeAdaptationBufferSRV;
		PassParameters->LogLuminanceWeightBuffer = Inputs.EyeAdaptationSetupSRV;
		PassParameters->OutputBuffer = OutputBufferUAV;

		TShaderMapRef<FMobileBasicEyeAdaptationCS> ComputeShader(View.ShaderMap);

		FComputeShaderUtils::AddPass(
			GraphBuilder,
			RDG_EVENT_NAME("BasicEyeAdaptation (CS)"),
			ComputeShader,

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessMobile.cpp:1994

Scope (from outer to inner):

file
function     void AddMobileEyeAdaptationPass

Source code excerpt:

	}
	else
	{
		FMobileHistogramEyeAdaptationCS::FParameters* PassParameters = GraphBuilder.AllocParameters<FMobileHistogramEyeAdaptationCS::FParameters>();

		PassParameters->EyeAdaptation = EyeAdaptationParameters;
		PassParameters->EyeAdaptationBuffer = EyeAdaptationBufferSRV;
		PassParameters->HistogramBuffer = Inputs.EyeAdaptationSetupSRV;
		PassParameters->OutputBuffer = OutputBufferUAV;

		TShaderMapRef<FMobileHistogramEyeAdaptationCS> ComputeShader(View.ShaderMap);

		FComputeShaderUtils::AddPass(
			GraphBuilder,
			RDG_EVENT_NAME("HistogramEyeAdaptation (CS)"),
			ComputeShader,
			PassParameters,

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessMobile.h:29

Scope: file

Source code excerpt:


struct FMobileBloomSetupOutputs
{
	FScreenPassTexture Bloom;
	FScreenPassTexture SunShaftAndDof;
	FScreenPassTexture EyeAdaptation;
};

FMobileBloomSetupOutputs AddMobileBloomSetupPass(FRDGBuilder& GraphBuilder, const FViewInfo& View, const FEyeAdaptationParameters& EyeAdaptationParameters, const FMobileBloomSetupInputs& Inputs);

struct FMobileDofNearInputs
{
	FScreenPassTexture BloomSetup_SunShaftAndDof;

	bool bUseSun = false;
};

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessTonemap.cpp:309

Scope: file

Source code excerpt:

	SHADER_PARAMETER_STRUCT_REF(FViewUniformShaderParameters, View)
	SHADER_PARAMETER_STRUCT_INCLUDE(FFilmGrainParameters, FilmGrain)
	SHADER_PARAMETER_STRUCT_INCLUDE(FTonemapperOutputDeviceParameters, OutputDevice)
	SHADER_PARAMETER_STRUCT(FScreenPassTextureViewportParameters, Color)
	SHADER_PARAMETER_STRUCT(FScreenPassTextureViewportParameters, Output)
	SHADER_PARAMETER_STRUCT(FEyeAdaptationParameters, EyeAdaptation)
	SHADER_PARAMETER_STRUCT(FLocalExposureParameters, LocalExposure)
	SHADER_PARAMETER_RDG_TEXTURE_SRV(Texture2D, ColorTexture)

	// Parameters to apply to the scene color.
	SHADER_PARAMETER_RDG_BUFFER_SRV(StructuredBuffer<float4>, SceneColorApplyParamaters)

	// Bloom texture
	SHADER_PARAMETER(FScreenTransform, ColorToBloom)
	SHADER_PARAMETER(FVector2f, BloomUVViewportBilinearMin)
	SHADER_PARAMETER(FVector2f, BloomUVViewportBilinearMax)
	SHADER_PARAMETER_RDG_TEXTURE(Texture2D, BloomTexture)

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessTonemap.cpp:587

Scope (from outer to inner):

file
function     FScreenPassTexture AddTonemapPass

Source code excerpt:


	const FSceneViewFamily& ViewFamily = *(View.Family);
	const FPostProcessSettings& PostProcessSettings = View.FinalPostProcessSettings;

	const bool bIsEyeAdaptationResource = Inputs.EyeAdaptationBuffer != nullptr;
	const bool bEyeAdaptation = ViewFamily.EngineShowFlags.EyeAdaptation && bIsEyeAdaptationResource;
	FRDGBufferRef EyeAdaptationBuffer = Inputs.EyeAdaptationBuffer;

	if (!bEyeAdaptation)
	{
		const float DefaultEyeAdaptation = GetEyeAdaptationFixedExposure(View);
		const FVector4f DefaultEyeAdaptationData(DefaultEyeAdaptation, 0, 0, DefaultEyeAdaptation);
		EyeAdaptationBuffer = CreateStructuredBuffer(GraphBuilder, TEXT("DefaultEyeAdaptationBuffer"), sizeof(DefaultEyeAdaptationData), 1, &DefaultEyeAdaptationData, sizeof(DefaultEyeAdaptationData), ERDGInitialDataFlags::None);
	}

	const FScreenPassTextureViewport SceneColorViewport(Inputs.SceneColor);

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessTonemap.cpp:813

Scope (from outer to inner):

file
function     FScreenPassTexture AddTonemapPass

Source code excerpt:

	CommonParameters.LumBilateralGrid = Inputs.LocalExposureTexture;
	CommonParameters.BlurredLogLum = Inputs.BlurredLogLuminanceTexture;
	CommonParameters.LumBilateralGridSampler = BilinearClampSampler;
	CommonParameters.BlurredLogLumSampler = BilinearClampSampler;
	CommonParameters.EyeAdaptationBuffer = GraphBuilder.CreateSRV(EyeAdaptationBuffer);
	CommonParameters.EyeAdaptation = *Inputs.EyeAdaptationParameters;
	CommonParameters.ColorGradingLUT = Inputs.ColorGradingTexture;
	CommonParameters.ColorSampler = BilinearClampSampler;
	CommonParameters.ColorGradingLUTSampler = BilinearClampSampler;
	CommonParameters.ColorScale0 = PostProcessSettings.SceneColorTint;
	CommonParameters.ChromaticAberrationParams = ChromaticAberrationParams;
	CommonParameters.TonemapperParams = FVector4f(PostProcessSettings.VignetteIntensity, SharpenDiv6, 0.0f, 0.0f);
	CommonParameters.EditorNITLevel = EditorNITLevel;
	{
		const bool bSupportsBackbufferQuantizationDithering = EDisplayOutputFormat(CommonParameters.OutputDevice.OutputDevice) != EDisplayOutputFormat::HDR_LinearNoToneCurve && EDisplayOutputFormat(CommonParameters.OutputDevice.OutputDevice) != EDisplayOutputFormat::HDR_LinearWithToneCurve;
		const int32 BitdepthOverride = CVarBackbufferQuantizationDitheringOverride.GetValueOnRenderThread();

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessVisualizeHDR.cpp:92

Scope (from outer to inner):

file
function     FScreenPassTexture AddVisualizeHDRPass

Source code excerpt:

	PassParameters->SceneColorSampler = BilinearClampSampler;
	PassParameters->HDRSceneColorTexture = Inputs.SceneColorBeforeTonemap.Texture;
	PassParameters->HDRSceneColorSampler = BilinearClampSampler;
	PassParameters->HistogramTexture = Inputs.HistogramTexture;
	PassParameters->EyeAdaptationBuffer = GraphBuilder.CreateSRV(Inputs.EyeAdaptationBuffer);
	PassParameters->EyeAdaptation = *Inputs.EyeAdaptationParameters;
	PassParameters->OutputDevice = GetTonemapperOutputDeviceParameters(*View.Family);
	PassParameters->MiniFontTexture = GetMiniFontTexture();
	PassParameters->FilmSlope = Settings.FilmSlope;
	PassParameters->FilmToe = Settings.FilmToe;
	PassParameters->FilmShoulder = Settings.FilmShoulder;
	PassParameters->FilmBlackClip = Settings.FilmBlackClip;
	PassParameters->FilmWhiteClip = Settings.FilmWhiteClip;
	PassParameters->IlluminanceMeterEnabled = IsIlluminanceMeterSupportedByView(View) ? 1.0f : 0.0f;
	

	TShaderMapRef<FVisualizeHDRPS> PixelShader(View.ShaderMap);

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessVisualizeLocalExposure.cpp:73

Scope (from outer to inner):

file
function     FScreenPassTexture AddVisualizeLocalExposurePass

Source code excerpt:

	const FPostProcessSettings& Settings = View.FinalPostProcessSettings;

	auto PassParameters = GraphBuilder.AllocParameters<FVisualizeLocalExposurePS::FParameters>();
	PassParameters->RenderTargets[0] = Output.GetRenderTargetBinding();
	PassParameters->View = View.ViewUniformBuffer;
	PassParameters->EyeAdaptation = *Inputs.EyeAdaptationParameters;
	PassParameters->LocalExposure = *Inputs.LocalExposureParameters;
	PassParameters->Input = GetScreenPassTextureViewportParameters(InputViewport);
	PassParameters->Output = GetScreenPassTextureViewportParameters(OutputViewport);
	PassParameters->HDRSceneColorTexture = Inputs.HDRSceneColor.Texture;
	PassParameters->EyeAdaptationBuffer = GraphBuilder.CreateSRV(Inputs.EyeAdaptationBuffer);
	PassParameters->LumBilateralGrid = Inputs.LumBilateralGridTexture;
	PassParameters->BlurredLogLum = Inputs.BlurredLumTexture;
	PassParameters->TextureSampler = BilinearClampSampler;
	PassParameters->DebugMode = CVarLocalExposureVisualizeDebugMode.GetValueOnRenderThread();

	TShaderMapRef<FVisualizeLocalExposurePS> PixelShader(View.ShaderMap);

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

Scope (from outer to inner):

file
function     void AddPostProcessingPasses

Source code excerpt:


		// Skip tonemapping for visualizers which overwrite the HDR scene color.
		const bool bTonemapEnabled = !bVisualizeMotionBlur;
		const bool bTonemapOutputInHDR = View.Family->SceneCaptureSource == SCS_FinalColorHDR || View.Family->SceneCaptureSource == SCS_FinalToneCurveHDR || bOutputInHDR || bViewFamilyOutputInHDR;

		// We don't test for the EyeAdaptation engine show flag here. If disabled, the auto exposure pass is still executes but performs a clamp.
		const bool bEyeAdaptationEnabled =
			// Skip for transient views.
			bHasViewState &&
			// Skip for secondary views in a stereo setup.
			bPrimaryView;

		const bool bHistogramEnabled =
			// Force the histogram on when we are visualizing HDR.
			bVisualizeHDR ||
			// Skip if not using histogram eye adaptation.
			(bEyeAdaptationEnabled && AutoExposureMethod == EAutoExposureMethod::AEM_Histogram &&

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

Scope (from outer to inner):

file
function     void AddMobilePostProcessingPasses

Source code excerpt:

		Distortion,
		SunMask,
		BloomSetup,
		DepthOfField,
		Bloom,
		EyeAdaptation,
		SunMerge,
		SeparateTranslucency,
		TAA,
		Tonemap,
		PostProcessMaterialAfterTonemapping,
		FXAA,
		HighResolutionScreenshotMask,
		SelectionOutline,
		EditorPrimitive,
#if UE_ENABLE_DEBUG_DRAWING
		DebugPrimitive,

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

Scope (from outer to inner):

file
function     void AddMobilePostProcessingPasses

Source code excerpt:

		PassSequence.SetEnabled(EPass::Distortion, bUseDistortion);
		PassSequence.SetEnabled(EPass::SunMask, bUseSun || bUseDof);
		PassSequence.SetEnabled(EPass::BloomSetup, bUseSun || bUseMobileDof || bUseBloom || bUseBasicEyeAdaptation || bUseHistogramEyeAdaptation);
		PassSequence.SetEnabled(EPass::DepthOfField, bUseDof);
		PassSequence.SetEnabled(EPass::Bloom, bUseBloom);
		PassSequence.SetEnabled(EPass::EyeAdaptation, bUseEyeAdaptation);
		PassSequence.SetEnabled(EPass::SunMerge, bUseBloom || bUseSun);
		PassSequence.SetEnabled(EPass::SeparateTranslucency, bUseSeparateTranslucency);
		PassSequence.SetEnabled(EPass::TAA, bUseTAA);
		PassSequence.SetEnabled(EPass::PostProcessMaterialAfterTonemapping, PostProcessMaterialAfterTonemappingChain.Num() != 0);
		PassSequence.SetEnabled(EPass::FXAA, View.AntiAliasingMethod == AAM_FXAA);
		PassSequence.Finalize();
			
		if (PassSequence.IsEnabled(EPass::Distortion))
		{
			PassSequence.AcceptPass(EPass::Distortion);
			FMobileDistortionAccumulateInputs DistortionAccumulateInputs;

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

Scope (from outer to inner):

file
function     void AddMobilePostProcessingPasses

Source code excerpt:

					FScreenPassTextureSlice::CreateFromScreenPassTexture(GraphBuilder, PostProcessDownsample_Bloom[LensFlareDownsampleStageIndex]),
					FScreenPassTextureSlice::CreateFromScreenPassTexture(GraphBuilder, PostProcessDownsample_Bloom[0]));
			}
		}

		if (PassSequence.IsEnabled(EPass::EyeAdaptation))
		{
			PassSequence.AcceptPass(EPass::EyeAdaptation);
			FMobileEyeAdaptationSetupInputs EyeAdaptationSetupInputs;
			
			EyeAdaptationSetupInputs.bUseBasicEyeAdaptation = bUseBasicEyeAdaptation;
			EyeAdaptationSetupInputs.bUseHistogramEyeAdaptation = bUseHistogramEyeAdaptation;
			EyeAdaptationSetupInputs.BloomSetup_EyeAdaptation = FScreenPassTexture(TryRegisterExternalTexture(GraphBuilder, View.PrevViewInfo.MobileBloomSetup_EyeAdaptation));
			if (!EyeAdaptationSetupInputs.BloomSetup_EyeAdaptation.IsValid())
			{
				EyeAdaptationSetupInputs.BloomSetup_EyeAdaptation = BloomSetupOutputs.EyeAdaptation;
			}

			FMobileEyeAdaptationSetupOutputs EyeAdaptationSetupOutputs = AddMobileEyeAdaptationSetupPass(GraphBuilder, View, EyeAdaptationParameters, EyeAdaptationSetupInputs);

			FMobileEyeAdaptationInputs EyeAdaptationInputs;
			EyeAdaptationInputs.bUseBasicEyeAdaptation = bUseBasicEyeAdaptation;
			EyeAdaptationInputs.bUseHistogramEyeAdaptation = bUseHistogramEyeAdaptation;
			EyeAdaptationInputs.EyeAdaptationSetupSRV = EyeAdaptationSetupOutputs.EyeAdaptationSetupSRV;
			EyeAdaptationInputs.EyeAdaptationBuffer = LastEyeAdaptationBuffer;

			AddMobileEyeAdaptationPass(GraphBuilder, View, EyeAdaptationParameters, EyeAdaptationInputs);

			if ((bUseBasicEyeAdaptation || bUseHistogramEyeAdaptation) && View.ViewState && !View.bStatePrevViewInfoIsReadOnly)
			{
				GraphBuilder.QueueTextureExtraction(BloomSetupOutputs.EyeAdaptation.Texture, &View.ViewState->PrevFrameViewInfo.MobileBloomSetup_EyeAdaptation);
			}
		}

		if (PassSequence.IsEnabled(EPass::SunMerge))
		{
			PassSequence.AcceptPass(EPass::SunMerge);
			FScreenPassTexture SunBlurOutputs;
			
			if (bUseSun)
			{
				FMobileSunAlphaInputs SunAlphaInputs;

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

Scope (from outer to inner):

file
function     void AddMobilePostProcessingPasses

Source code excerpt:

			if ((bUseBasicEyeAdaptation || bUseHistogramEyeAdaptation) && View.ViewState && !View.bStatePrevViewInfoIsReadOnly)
			{
				GraphBuilder.QueueTextureExtraction(BloomSetupOutputs.EyeAdaptation.Texture, &View.ViewState->PrevFrameViewInfo.MobileBloomSetup_EyeAdaptation);
			}
		}

		if (PassSequence.IsEnabled(EPass::SunMerge))
		{
			PassSequence.AcceptPass(EPass::SunMerge);

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

Scope (from outer to inner):

file
function     void AddMobilePostProcessingPasses

Source code excerpt:

		PassSequence.SetEnabled(EPass::Distortion, false);
		PassSequence.SetEnabled(EPass::SunMask, false);
		PassSequence.SetEnabled(EPass::BloomSetup, false);
		PassSequence.SetEnabled(EPass::DepthOfField, false);
		PassSequence.SetEnabled(EPass::Bloom, false);
		PassSequence.SetEnabled(EPass::EyeAdaptation, false);
		PassSequence.SetEnabled(EPass::SunMerge, false);
		PassSequence.SetEnabled(EPass::SeparateTranslucency, false);
		PassSequence.SetEnabled(EPass::TAA, false);
		PassSequence.SetEnabled(EPass::PostProcessMaterialAfterTonemapping, false);
		PassSequence.SetEnabled(EPass::FXAA, false);
		PassSequence.Finalize();
	}
	
	if (PassSequence.IsEnabled(EPass::Tonemap))
	{
		bool bHDRTonemapperOutput = false;

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

Scope: file

Source code excerpt:

FASTVRAM_CVAR(Bloom, 1);
FASTVRAM_CVAR(BokehDOF, 1);
FASTVRAM_CVAR(CircleDOF, 1);
FASTVRAM_CVAR(CombineLUTs, 1);
FASTVRAM_CVAR(Downsample, 1);
FASTVRAM_CVAR(EyeAdaptation, 1);
FASTVRAM_CVAR(Histogram, 1);
FASTVRAM_CVAR(HistogramReduce, 1);
FASTVRAM_CVAR(VelocityFlat, 1);
FASTVRAM_CVAR(VelocityMax, 1);
FASTVRAM_CVAR(MotionBlur, 1);
FASTVRAM_CVAR(Tonemap, 1);
FASTVRAM_CVAR(Upscale, 1);
FASTVRAM_CVAR(DistanceFieldNormal, 1);
FASTVRAM_CVAR(DistanceFieldAOHistory, 1);
FASTVRAM_CVAR(DistanceFieldAODownsampledBentNormal, 1); 
FASTVRAM_CVAR(DistanceFieldAOBentNormal, 0); 

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

Scope (from outer to inner):

file
function     void FFastVramConfig::Update

Source code excerpt:

	bDirty |= UpdateTextureFlagFromCVar(CVarFastVRam_Bloom, Bloom);
	bDirty |= UpdateTextureFlagFromCVar(CVarFastVRam_BokehDOF, BokehDOF);
	bDirty |= UpdateTextureFlagFromCVar(CVarFastVRam_CircleDOF, CircleDOF);
	bDirty |= UpdateTextureFlagFromCVar(CVarFastVRam_CombineLUTs, CombineLUTs);
	bDirty |= UpdateTextureFlagFromCVar(CVarFastVRam_Downsample, Downsample);
	bDirty |= UpdateTextureFlagFromCVar(CVarFastVRam_EyeAdaptation, EyeAdaptation);
	bDirty |= UpdateTextureFlagFromCVar(CVarFastVRam_Histogram, Histogram);
	bDirty |= UpdateTextureFlagFromCVar(CVarFastVRam_HistogramReduce, HistogramReduce);
	bDirty |= UpdateTextureFlagFromCVar(CVarFastVRam_VelocityFlat, VelocityFlat);
	bDirty |= UpdateTextureFlagFromCVar(CVarFastVRam_VelocityMax, VelocityMax);
	bDirty |= UpdateTextureFlagFromCVar(CVarFastVRam_MotionBlur, MotionBlur);
	bDirty |= UpdateTextureFlagFromCVar(CVarFastVRam_Tonemap, Tonemap);
	bDirty |= UpdateTextureFlagFromCVar(CVarFastVRam_Upscale, Upscale);
	bDirty |= UpdateTextureFlagFromCVar(CVarFastVRam_DistanceFieldNormal, DistanceFieldNormal);
	bDirty |= UpdateTextureFlagFromCVar(CVarFastVRam_DistanceFieldAOHistory, DistanceFieldAOHistory);
	bDirty |= UpdateTextureFlagFromCVar(CVarFastVRam_DistanceFieldAODownsampledBentNormal, DistanceFieldAODownsampledBentNormal);
	bDirty |= UpdateTextureFlagFromCVar(CVarFastVRam_DistanceFieldAOBentNormal, DistanceFieldAOBentNormal);

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

Scope: file

Source code excerpt:

	ETextureCreateFlags Bloom;
	ETextureCreateFlags BokehDOF;
	ETextureCreateFlags CircleDOF;
	ETextureCreateFlags CombineLUTs;
	ETextureCreateFlags Downsample;
	ETextureCreateFlags EyeAdaptation;
	ETextureCreateFlags Histogram;
	ETextureCreateFlags HistogramReduce;
	ETextureCreateFlags VelocityFlat;
	ETextureCreateFlags VelocityMax;
	ETextureCreateFlags MotionBlur;
	ETextureCreateFlags Tonemap;
	ETextureCreateFlags Upscale;
	ETextureCreateFlags DistanceFieldNormal;
	ETextureCreateFlags DistanceFieldAOHistory;
	ETextureCreateFlags DistanceFieldAOBentNormal;
	ETextureCreateFlags DistanceFieldAODownsampledBentNormal;