diff --git a/Gems/Atom/Feature/Common/Code/Source/CoreLights/DepthExponentiationPass.cpp b/Gems/Atom/Feature/Common/Code/Source/CoreLights/DepthExponentiationPass.cpp index eee160080c..f249ca811a 100644 --- a/Gems/Atom/Feature/Common/Code/Source/CoreLights/DepthExponentiationPass.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/CoreLights/DepthExponentiationPass.cpp @@ -37,9 +37,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]); @@ -54,6 +58,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 ef33b89d56..6ad9a21bef 100644 --- a/Gems/Atom/Feature/Common/Code/Source/CoreLights/DepthExponentiationPass.h +++ b/Gems/Atom/Feature/Common/Code/Source/CoreLights/DepthExponentiationPass.h @@ -45,13 +45,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 5d7aa5d6d3..7790f577d6 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 @@ -149,7 +149,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