Fix for shader option in DepthExponentiation not being set on loading into Editor

This commit is contained in:
mriegger
2021-06-23 11:51:43 -07:00
parent 6557a14e36
commit da1390b7e8
3 changed files with 16 additions and 4 deletions
@@ -42,9 +42,13 @@ namespace AZ
InitializeShaderOption();
m_shaderOptionInitialized = true;
}
m_shadowmapType = type;
const uint32_t typeIndex = aznumeric_cast<uint32_t>(type);
SetShaderVariantKeyFallbackValue();
}
void DepthExponentiationPass::SetShaderVariantKeyFallbackValue()
{
const uint32_t typeIndex = aznumeric_cast<uint32_t>(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)
@@ -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<Name> m_optionValues;
@@ -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