Pass changes WIP: standardized usage of new pass initialization functions

This commit is contained in:
antonmic
2021-06-08 22:36:54 -07:00
parent 6973d9c7a3
commit 702356007c
40 changed files with 127 additions and 107 deletions
@@ -64,6 +64,8 @@ namespace AZ
void FullscreenTrianglePass::LoadShader()
{
AZ_Assert(GetPassState() != PassState::Rendering, "FullscreenTrianglePass - Reloading shader during Rendering phase!");
// Load FullscreenTrianglePassData
const FullscreenTrianglePassData* passData = PassUtils::GetPassData<FullscreenTrianglePassData>(m_passDescriptor);
if (passData == nullptr)
@@ -121,14 +123,16 @@ namespace AZ
// Store stencil reference value for the draw call
m_stencilRef = passData->m_stencilRef;
m_flags.m_initialized = false;
QueueForInitialization();
ShaderReloadNotificationBus::Handler::BusDisconnect();
ShaderReloadNotificationBus::Handler::BusConnect(shaderAsset.GetId());
}
void FullscreenTrianglePass::Init()
void FullscreenTrianglePass::InitializeInternal()
{
RenderPass::InitializeInternal();
// This draw item purposefully does not reference any geometry buffers.
// Instead it's expected that the extended class uses a vertex shader
// that generates a full-screen triangle completely from vertex ids.
@@ -155,17 +159,10 @@ namespace AZ
m_item.m_arguments = RHI::DrawArguments(draw);
m_item.m_pipelineState = m_shader->AcquirePipelineState(pipelineStateDescriptor);
m_item.m_stencilRef = m_stencilRef;
m_flags.m_initialized = true;
}
void FullscreenTrianglePass::FrameBeginInternal(FramePrepareParams params)
{
if (!m_flags.m_initialized)
{
Init();
}
const PassAttachment* outputAttachment = nullptr;
if (GetOutputCount() > 0)
@@ -225,11 +222,6 @@ namespace AZ
commandList->Submit(m_item);
}
void FullscreenTrianglePass::Invalidate()
{
m_flags.m_initialized = false;
}
} // namespace RPI
} // namespace AZ