diff --git a/Gems/Atom/Feature/Common/Code/Source/CoreLights/DepthExponentiationPass.cpp b/Gems/Atom/Feature/Common/Code/Source/CoreLights/DepthExponentiationPass.cpp index 5a469e83bf..2de189dc23 100644 --- a/Gems/Atom/Feature/Common/Code/Source/CoreLights/DepthExponentiationPass.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/CoreLights/DepthExponentiationPass.cpp @@ -42,9 +42,13 @@ namespace AZ InitializeShaderOption(); m_shaderOptionInitialized = true; } - m_shadowmapType = type; - const uint32_t typeIndex = aznumeric_cast(type); + SetShaderVariantKeyFallbackValue(); + } + + void DepthExponentiationPass::SetShaderVariantKeyFallbackValue() + { + const uint32_t typeIndex = aznumeric_cast(m_shadowmapType); RPI::ShaderOptionGroup shaderOption = m_shader->CreateShaderOptionGroup(); shaderOption.SetValue(m_optionName, m_optionValues[typeIndex]); @@ -59,6 +63,11 @@ namespace AZ return m_shadowmapType; } + void DepthExponentiationPass::BuildInternal() + { + InitializeShaderOption(); + } + void DepthExponentiationPass::FrameBeginInternal(FramePrepareParams params) { if (!m_shaderOptionInitialized) diff --git a/Gems/Atom/Feature/Common/Code/Source/CoreLights/DepthExponentiationPass.h b/Gems/Atom/Feature/Common/Code/Source/CoreLights/DepthExponentiationPass.h index 9ec580d0f6..d2bb4b4963 100644 --- a/Gems/Atom/Feature/Common/Code/Source/CoreLights/DepthExponentiationPass.h +++ b/Gems/Atom/Feature/Common/Code/Source/CoreLights/DepthExponentiationPass.h @@ -50,13 +50,16 @@ namespace AZ explicit DepthExponentiationPass(const RPI::PassDescriptor& descriptor); // RPI::Pass overrides... + void BuildInternal() override; void FrameBeginInternal(FramePrepareParams params) override; - + // Scope producer functions... void CompileResources(const RHI::FrameGraphCompileContext& context) override; void BuildCommandListInternal(const RHI::FrameGraphExecuteContext& context) override; + void InitializeShaderOption(); + void SetShaderVariantKeyFallbackValue(); const Name m_optionName; const AZStd::vector m_optionValues; diff --git a/Gems/Atom/RPI/Code/Include/Atom/RPI.Public/Pass/Pass.h b/Gems/Atom/RPI/Code/Include/Atom/RPI.Public/Pass/Pass.h index a4a26c3070..9ddf842228 100644 --- a/Gems/Atom/RPI/Code/Include/Atom/RPI.Public/Pass/Pass.h +++ b/Gems/Atom/RPI/Code/Include/Atom/RPI.Public/Pass/Pass.h @@ -154,7 +154,7 @@ namespace AZ // --- Utility functions --- - //! Queues the pass to have Build() and Initilize() called by the PassSystem on frame update + //! Queues the pass to have Build() and Initialize() called by the PassSystem on frame update void QueueForBuildAndInitialization(); //! Queues the pass to have RemoveFromParent() called by the PassSystem on frame update