Merge pull request #1215 from aws-lumberyard-dev/Atom/antonmic/PassChanges
[ATOM-15590] Pass System Improvements
This commit is contained in:
+3
-1
@@ -48,7 +48,9 @@ namespace AZ
|
||||
void SetShaperParams(const ShaperParams& shaperParams);
|
||||
private:
|
||||
explicit AcesOutputTransformLutPass(const RPI::PassDescriptor& descriptor);
|
||||
void Init() override;
|
||||
|
||||
// Pass behavior overrides...
|
||||
void InitializeInternal() override;
|
||||
|
||||
// Scope producer functions...
|
||||
void SetupFrameGraphDependencies(RHI::FrameGraphInterface frameGraph) override;
|
||||
|
||||
+3
-1
@@ -50,7 +50,9 @@ namespace AZ
|
||||
|
||||
private:
|
||||
explicit AcesOutputTransformPass(const RPI::PassDescriptor& descriptor);
|
||||
void Init() override;
|
||||
|
||||
// Pass behavior overrides
|
||||
void InitializeInternal() override;
|
||||
|
||||
// Scope producer functions...
|
||||
void CompileResources(const RHI::FrameGraphCompileContext& context) override;
|
||||
|
||||
+3
-1
@@ -45,7 +45,9 @@ namespace AZ
|
||||
|
||||
protected:
|
||||
explicit ApplyShaperLookupTablePass(const RPI::PassDescriptor& descriptor);
|
||||
void Init() override;
|
||||
|
||||
// Pass behavior overrides...
|
||||
void InitializeInternal() override;
|
||||
|
||||
RHI::ShaderInputImageIndex m_shaderInputLutImageIndex;
|
||||
|
||||
|
||||
+1
-3
@@ -57,15 +57,13 @@ namespace AZ
|
||||
explicit BakeAcesOutputTransformLutPass(const RPI::PassDescriptor& descriptor);
|
||||
|
||||
// Pass behavior overrides...
|
||||
void FrameBeginInternal(FramePrepareParams params) override;
|
||||
void InitializeInternal() override;
|
||||
|
||||
// RHI::ScopeProducer overrides...
|
||||
void SetupFrameGraphDependencies(RHI::FrameGraphInterface frameGraph) override;
|
||||
void CompileResources(const RHI::FrameGraphCompileContext& context) override;
|
||||
void BuildCommandListInternal(const RHI::FrameGraphExecuteContext& context) override;
|
||||
|
||||
void Init();
|
||||
|
||||
void AcquireLutImage();
|
||||
void ReleaseLutImage();
|
||||
|
||||
|
||||
+2
-5
@@ -41,14 +41,11 @@ namespace AZ
|
||||
void SetInputReferencePassName(const Name& passName);
|
||||
void SetInputReferenceAttachmentName(const Name& attachmentName);
|
||||
|
||||
// Pass behavior overrides
|
||||
virtual void BuildAttachmentsInternal() override;
|
||||
|
||||
protected:
|
||||
explicit DisplayMapperFullScreenPass(const RPI::PassDescriptor& descriptor);
|
||||
|
||||
// FullscreenTrianglePass behavior overrides
|
||||
virtual void Init();
|
||||
// Pass behavior overrides...
|
||||
virtual void BuildInternal() override;
|
||||
|
||||
private:
|
||||
Name m_inputReferencePassName = Name{ "Parent" };
|
||||
|
||||
+2
-1
@@ -76,7 +76,8 @@ namespace AZ
|
||||
DisplayMapperPass(const RPI::PassDescriptor& descriptor);
|
||||
|
||||
// Pass behavior overrides
|
||||
void BuildAttachmentsInternal() final;
|
||||
void BuildInternal() final;
|
||||
void InitializeInternal() final;
|
||||
void FrameBeginInternal(FramePrepareParams params) final;
|
||||
void FrameEndInternal() final;
|
||||
void CreateChildPassesInternal() final;
|
||||
|
||||
+3
-1
@@ -49,7 +49,9 @@ namespace AZ
|
||||
|
||||
protected:
|
||||
explicit OutputTransformPass(const RPI::PassDescriptor& descriptor);
|
||||
void Init() override;
|
||||
|
||||
// Pass behavior overrides
|
||||
void InitializeInternal() override;
|
||||
|
||||
private:
|
||||
// Scope producer functions...
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace AZ
|
||||
protected:
|
||||
// Pass behavior overrides
|
||||
void CreateChildPassesInternal() final;
|
||||
void BuildAttachmentsInternal() final;
|
||||
void BuildInternal() final;
|
||||
void FrameBeginInternal(FramePrepareParams params) final;
|
||||
|
||||
private:
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace AZ
|
||||
|
||||
private:
|
||||
|
||||
void BuildAttachmentsInternal() override;
|
||||
void BuildInternal() override;
|
||||
void FrameBeginInternal(FramePrepareParams params) override;
|
||||
|
||||
void UpdataAttachment();
|
||||
|
||||
@@ -60,7 +60,7 @@ namespace AZ
|
||||
Base::FrameBeginInternal(params);
|
||||
}
|
||||
|
||||
void CheckerboardColorResolvePass::BuildAttachmentsInternal()
|
||||
void CheckerboardColorResolvePass::BuildInternal()
|
||||
{
|
||||
// For each bound attachments they are the inputs from current frame.
|
||||
// We use them to get their owner CheckerboardPass then find the render targets from last frame
|
||||
@@ -99,7 +99,7 @@ namespace AZ
|
||||
// reset frame offset to 0 since attachments are rebuilt
|
||||
m_frameOffset = 0;
|
||||
|
||||
Base::BuildAttachmentsInternal();
|
||||
Base::BuildInternal();
|
||||
}
|
||||
|
||||
void CheckerboardColorResolvePass::CompileResources(const RHI::FrameGraphCompileContext& context)
|
||||
@@ -135,7 +135,7 @@ namespace AZ
|
||||
void CheckerboardColorResolvePass::FrameEndInternal()
|
||||
{
|
||||
// For the input slots for current frame, they always get updated when CheckerboardPass updates the render targets
|
||||
// But for the input slots for previous frame, we need to manually update them since they were manually attached in BuildAttachmentsInternal()
|
||||
// But for the input slots for previous frame, we need to manually update them since they were manually attached in BuildInternal()
|
||||
//
|
||||
// When pass attachment was built, CheckerboardPass creates two resources for each render target.
|
||||
// For example, diffuse_0 and diffuse_1 which diffuse_0 is for even frame and diffuse_1 is for odd frame.
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace AZ
|
||||
protected:
|
||||
// Pass overrides...
|
||||
void FrameBeginInternal(FramePrepareParams params) override;
|
||||
void BuildAttachmentsInternal() override;
|
||||
void BuildInternal() override;
|
||||
void FrameEndInternal() override;
|
||||
|
||||
// Scope producer functions...
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace AZ
|
||||
Base::FrameBeginInternal(params);
|
||||
}
|
||||
|
||||
void CheckerboardPass::BuildAttachmentsInternal()
|
||||
void CheckerboardPass::BuildInternal()
|
||||
{
|
||||
Data::Instance<RPI::AttachmentImagePool> pool = RPI::ImageSystemInterface::Get()->GetSystemAttachmentPool();
|
||||
|
||||
@@ -101,7 +101,7 @@ namespace AZ
|
||||
// reset frame offset to 0 since attachments are rebuilt
|
||||
m_frameOffset = 0;
|
||||
|
||||
Base::BuildAttachmentsInternal();
|
||||
Base::BuildInternal();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace AZ
|
||||
protected:
|
||||
// Pass overrides...
|
||||
void FrameBeginInternal(FramePrepareParams params);
|
||||
void BuildAttachmentsInternal() override;
|
||||
void BuildInternal() override;
|
||||
void FrameEndInternal() override;
|
||||
|
||||
private:
|
||||
|
||||
@@ -100,7 +100,7 @@ namespace AZ
|
||||
m_arraySize = arraySize;
|
||||
m_updateChildren = true;
|
||||
|
||||
QueueForBuildAttachments();
|
||||
QueueForBuildAndInitialization();
|
||||
|
||||
m_atlas.Initialize();
|
||||
for (size_t cascadeIndex = 0; cascadeIndex < m_arraySize; ++cascadeIndex)
|
||||
@@ -149,7 +149,7 @@ namespace AZ
|
||||
return m_atlas;
|
||||
}
|
||||
|
||||
void CascadedShadowmapsPass::BuildAttachmentsInternal()
|
||||
void CascadedShadowmapsPass::BuildInternal()
|
||||
{
|
||||
UpdateChildren();
|
||||
|
||||
@@ -159,7 +159,7 @@ namespace AZ
|
||||
}
|
||||
|
||||
UpdateShadowmapImageSize();
|
||||
Base::BuildAttachmentsInternal();
|
||||
Base::BuildInternal();
|
||||
}
|
||||
|
||||
void CascadedShadowmapsPass::GetPipelineViewTags(RPI::SortedPipelineViewTags& outTags) const
|
||||
@@ -215,7 +215,7 @@ namespace AZ
|
||||
AZ_RPI_PASS_WARNING(child, "CascadedShadowmapsPass child Pass creation failed for %d", cascadeIndex);
|
||||
if (child)
|
||||
{
|
||||
child->QueueForBuildAttachments();
|
||||
child->QueueForBuildAndInitialization();
|
||||
AddChild(child);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace AZ
|
||||
explicit CascadedShadowmapsPass(const RPI::PassDescriptor& descriptor);
|
||||
|
||||
// RPI::Pass overrides...
|
||||
void BuildAttachmentsInternal() override;
|
||||
void BuildInternal() override;
|
||||
void GetPipelineViewTags(RPI::SortedPipelineViewTags& outTags) const override;
|
||||
void GetViewDrawListInfo(RHI::DrawListMask& outDrawListMask, RPI::PassesByDrawList& outPassesByDrawList, const RPI::PipelineViewTag& viewTag) const override;
|
||||
|
||||
|
||||
+1
-1
@@ -1106,7 +1106,7 @@ namespace AZ
|
||||
{
|
||||
for (EsmShadowmapsPass* pass : it.second)
|
||||
{
|
||||
pass->QueueForBuildAttachments();
|
||||
pass->QueueForBuildAndInitialization();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -163,7 +163,6 @@ namespace AZ
|
||||
|
||||
void LightCullingPass::ResetInternal()
|
||||
{
|
||||
m_initialized = false;
|
||||
m_tileDataIndex = -1;
|
||||
m_constantDataIndex.Reset();
|
||||
|
||||
@@ -260,7 +259,7 @@ namespace AZ
|
||||
return gridPixelSize;
|
||||
}
|
||||
|
||||
void LightCullingPass::BuildAttachmentsInternal()
|
||||
void LightCullingPass::BuildInternal()
|
||||
{
|
||||
m_tileDataIndex = FindInputBinding(AZ::Name("TileLightData"));
|
||||
CreateLightList();
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace AZ
|
||||
|
||||
// Pass behavior overrides...
|
||||
void ResetInternal()override;
|
||||
void BuildAttachmentsInternal() override;
|
||||
void BuildInternal() override;
|
||||
|
||||
// Scope producer functions...
|
||||
void CompileResources(const RHI::FrameGraphCompileContext& context) override;
|
||||
@@ -96,7 +96,6 @@ namespace AZ
|
||||
|
||||
AZ::RHI::ShaderInputNameIndex m_constantDataIndex = "m_constantData";
|
||||
|
||||
bool m_initialized = false;
|
||||
Data::Instance<RPI::Buffer> m_lightList;
|
||||
|
||||
uint32_t m_tileDataIndex = -1;
|
||||
|
||||
@@ -108,7 +108,7 @@ namespace AZ
|
||||
return -1;
|
||||
}
|
||||
|
||||
void LightCullingRemap::BuildAttachmentsInternal()
|
||||
void LightCullingRemap::BuildInternal()
|
||||
{
|
||||
m_tileDataIndex = FindInputOutputBinding(AZ::Name("TileLightData"));
|
||||
m_tileDim = GetTileDataBufferResolution();
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace AZ
|
||||
|
||||
// Pass behavior overrides...
|
||||
void ResetInternal()override;
|
||||
void BuildAttachmentsInternal() override;
|
||||
void BuildInternal() override;
|
||||
|
||||
// RHI::ScopeProducer overrides...
|
||||
void SetupFrameGraphDependencies(RHI::FrameGraphInterface frameGraph) override;
|
||||
|
||||
@@ -167,37 +167,36 @@ namespace AZ
|
||||
AZ_Assert(setOk, "LightCullingTilePreparePass::SetConstantData() - could not set constant data");
|
||||
}
|
||||
|
||||
void LightCullingTilePreparePass::BuildAttachmentsInternal()
|
||||
void LightCullingTilePreparePass::BuildInternal()
|
||||
{
|
||||
ChooseShaderVariant();
|
||||
}
|
||||
|
||||
void LightCullingTilePreparePass::OnShaderReinitialized(const AZ::RPI::Shader&)
|
||||
void LightCullingTilePreparePass::OnShaderReloaded()
|
||||
{
|
||||
LoadShader();
|
||||
if (!m_flags.m_queuedForBuildAttachment && !m_flags.m_isBuildingAttachments)
|
||||
AZ_Assert(GetPassState() != RPI::PassState::Rendering, "LightCullingTilePreparePass: Trying to reload shader during rendering");
|
||||
if (GetPassState() == RPI::PassState::Idle)
|
||||
{
|
||||
ChooseShaderVariant();
|
||||
}
|
||||
}
|
||||
|
||||
void LightCullingTilePreparePass::OnShaderReinitialized(const AZ::RPI::Shader&)
|
||||
{
|
||||
OnShaderReloaded();
|
||||
}
|
||||
|
||||
void LightCullingTilePreparePass::OnShaderAssetReinitialized(const Data::Asset<AZ::RPI::ShaderAsset>&)
|
||||
{
|
||||
LoadShader();
|
||||
if (!m_flags.m_queuedForBuildAttachment && !m_flags.m_isBuildingAttachments)
|
||||
{
|
||||
ChooseShaderVariant();
|
||||
}
|
||||
OnShaderReloaded();
|
||||
}
|
||||
|
||||
void LightCullingTilePreparePass::OnShaderVariantReinitialized(
|
||||
const AZ::RPI::Shader&, const AZ::RPI::ShaderVariantId&,
|
||||
AZ::RPI::ShaderVariantStableId)
|
||||
{
|
||||
LoadShader();
|
||||
if (!m_flags.m_queuedForBuildAttachment && !m_flags.m_isBuildingAttachments)
|
||||
{
|
||||
ChooseShaderVariant();
|
||||
}
|
||||
OnShaderReloaded();
|
||||
}
|
||||
|
||||
} // namespace Render
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace AZ
|
||||
LightCullingTilePreparePass(const RPI::PassDescriptor& descriptor);
|
||||
|
||||
// Pass behavior overrides...
|
||||
void BuildAttachmentsInternal() override;
|
||||
void BuildInternal() override;
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// ShaderReloadNotificationBus overrides...
|
||||
@@ -73,6 +73,7 @@ namespace AZ
|
||||
const AZ::RPI::ShaderVariant& CreateShaderVariant();
|
||||
void CreatePipelineStateFromShaderVariant(const RPI::ShaderVariant& shaderVariant);
|
||||
void SetConstantData();
|
||||
void OnShaderReloaded();
|
||||
|
||||
AZ::RHI::ShaderInputNameIndex m_constantDataIndex = "m_constantData";
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ namespace AZ
|
||||
{
|
||||
m_sizes = sizes;
|
||||
m_updateChildren = true;
|
||||
QueueForBuildAttachments();
|
||||
QueueForBuildAndInitialization();
|
||||
|
||||
m_atlas.Initialize();
|
||||
for (const auto& it : m_sizes)
|
||||
@@ -156,7 +156,7 @@ namespace AZ
|
||||
return m_atlas;
|
||||
}
|
||||
|
||||
void ProjectedShadowmapsPass::BuildAttachmentsInternal()
|
||||
void ProjectedShadowmapsPass::BuildInternal()
|
||||
{
|
||||
UpdateChildren();
|
||||
|
||||
@@ -177,7 +177,7 @@ namespace AZ
|
||||
imageDescriptor.m_size = RHI::Size(shadowmapWidth, shadowmapWidth, 1);
|
||||
imageDescriptor.m_arraySize = m_atlas.GetArraySliceCount();
|
||||
|
||||
Base::BuildAttachmentsInternal();
|
||||
Base::BuildInternal();
|
||||
}
|
||||
|
||||
void ProjectedShadowmapsPass::GetPipelineViewTags(RPI::SortedPipelineViewTags& outTags) const
|
||||
|
||||
@@ -71,7 +71,7 @@ namespace AZ
|
||||
explicit ProjectedShadowmapsPass(const RPI::PassDescriptor& descriptor);
|
||||
|
||||
// RPI::Pass overrides...
|
||||
void BuildAttachmentsInternal() override;
|
||||
void BuildInternal() override;
|
||||
void GetPipelineViewTags(RPI::SortedPipelineViewTags& outTags) const override;
|
||||
void GetViewDrawListInfo(RHI::DrawListMask& outDrawListMask, RPI::PassesByDrawList& outPassesByDrawList, const RPI::PipelineViewTag& viewTag) const override;
|
||||
|
||||
|
||||
@@ -107,7 +107,7 @@ namespace AZ
|
||||
m_scissorState = scissor;
|
||||
}
|
||||
|
||||
void ShadowmapPass::BuildAttachmentsInternal()
|
||||
void ShadowmapPass::BuildInternal()
|
||||
{
|
||||
RPI::Ptr<RPI::ParentPass> parentPass = GetParent();
|
||||
if (!parentPass)
|
||||
@@ -135,7 +135,7 @@ namespace AZ
|
||||
action.m_loadAction = m_clearEnabled ? RHI::AttachmentLoadAction::Clear : RHI::AttachmentLoadAction::DontCare;
|
||||
binding.m_unifiedScopeDesc = RHI::UnifiedScopeAttachmentDescriptor(attachmentId, imageViewDescriptor, action);
|
||||
|
||||
Base::BuildAttachmentsInternal();
|
||||
Base::BuildInternal();
|
||||
}
|
||||
|
||||
} // namespace Render
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace AZ
|
||||
explicit ShadowmapPass(const RPI::PassDescriptor& descriptor);
|
||||
|
||||
// RHI::Pass overrides...
|
||||
void BuildAttachmentsInternal() override;
|
||||
void BuildInternal() override;
|
||||
|
||||
uint16_t m_arraySlice = 0;
|
||||
bool m_clearEnabled = true;
|
||||
|
||||
@@ -42,9 +42,9 @@ namespace AZ
|
||||
ReleaseLutImage();
|
||||
}
|
||||
|
||||
void AcesOutputTransformLutPass::Init()
|
||||
void AcesOutputTransformLutPass::InitializeInternal()
|
||||
{
|
||||
DisplayMapperFullScreenPass::Init();
|
||||
DisplayMapperFullScreenPass::InitializeInternal();
|
||||
|
||||
AZ_Assert(m_shaderResourceGroup != nullptr, "AcesOutputTransformLutPass %s has a null shader resource group when calling Init.", GetPathName().GetCStr());
|
||||
|
||||
|
||||
@@ -44,9 +44,9 @@ namespace AZ
|
||||
{
|
||||
}
|
||||
|
||||
void AcesOutputTransformPass::Init()
|
||||
void AcesOutputTransformPass::InitializeInternal()
|
||||
{
|
||||
DisplayMapperFullScreenPass::Init();
|
||||
DisplayMapperFullScreenPass::InitializeInternal();
|
||||
|
||||
AZ_Assert(m_shaderResourceGroup != nullptr, "AcesOutputTransformPass %s has a null shader resource group when calling Init.", GetPathName().GetCStr());
|
||||
|
||||
|
||||
@@ -38,9 +38,9 @@ namespace AZ
|
||||
ReleaseLutImage();
|
||||
}
|
||||
|
||||
void ApplyShaperLookupTablePass::Init()
|
||||
void ApplyShaperLookupTablePass::InitializeInternal()
|
||||
{
|
||||
DisplayMapperFullScreenPass::Init();
|
||||
DisplayMapperFullScreenPass::InitializeInternal();
|
||||
|
||||
AZ_Assert(m_shaderResourceGroup != nullptr, "ApplyShaperLookupTablePass %s has a null shader resource group when calling Init.", GetPathName().GetCStr());
|
||||
|
||||
|
||||
+1
-12
@@ -38,17 +38,7 @@ namespace AZ
|
||||
ReleaseLutImage();
|
||||
}
|
||||
|
||||
void BakeAcesOutputTransformLutPass::FrameBeginInternal(FramePrepareParams params)
|
||||
{
|
||||
if (!m_flags.m_initialized)
|
||||
{
|
||||
Init();
|
||||
}
|
||||
|
||||
ComputePass::FrameBeginInternal(params);
|
||||
}
|
||||
|
||||
void BakeAcesOutputTransformLutPass::Init()
|
||||
void BakeAcesOutputTransformLutPass::InitializeInternal()
|
||||
{
|
||||
AZ_Assert(m_shaderResourceGroup != nullptr, "BakeAcesOutputTransformLutPass %s has a null shader resource group when calling Init.", GetPathName().GetCStr());
|
||||
|
||||
@@ -67,7 +57,6 @@ namespace AZ
|
||||
m_shaderInputShaperBiasIndex = m_shaderResourceGroup->FindShaderInputConstantIndex(Name{ "m_shaperBias" });
|
||||
m_shaderInputShaperScaleIndex = m_shaderResourceGroup->FindShaderInputConstantIndex(Name{ "m_shaperScale" });
|
||||
}
|
||||
m_flags.m_initialized = true;
|
||||
}
|
||||
|
||||
void BakeAcesOutputTransformLutPass::SetupFrameGraphDependencies(RHI::FrameGraphInterface frameGraph)
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace AZ
|
||||
{
|
||||
}
|
||||
|
||||
void DisplayMapperFullScreenPass::BuildAttachmentsInternal()
|
||||
void DisplayMapperFullScreenPass::BuildInternal()
|
||||
{
|
||||
RPI::PassConnection inConnection;
|
||||
inConnection.m_localSlot = InputAttachmentName;
|
||||
@@ -53,9 +53,5 @@ namespace AZ
|
||||
m_inputReferenceAttachmentName = attachmentName;
|
||||
}
|
||||
|
||||
void DisplayMapperFullScreenPass::Init()
|
||||
{
|
||||
FullscreenTrianglePass::Init();
|
||||
}
|
||||
} // namespace Render
|
||||
} // namespace AZ
|
||||
|
||||
@@ -46,8 +46,6 @@ namespace AZ
|
||||
DisplayMapperPass::DisplayMapperPass(const RPI::PassDescriptor& descriptor)
|
||||
: RPI::ParentPass(descriptor)
|
||||
{
|
||||
m_flags.m_alreadyCreated = false;
|
||||
|
||||
AzFramework::NativeWindowHandle windowHandle = nullptr;
|
||||
AzFramework::WindowSystemRequestBus::BroadcastResult(
|
||||
windowHandle,
|
||||
@@ -61,8 +59,6 @@ namespace AZ
|
||||
{
|
||||
m_displayMapperConfigurationDescriptor = passData->m_config;
|
||||
}
|
||||
|
||||
m_needToRebuildChildren = true;
|
||||
}
|
||||
|
||||
DisplayMapperPass::~DisplayMapperPass()
|
||||
@@ -86,7 +82,7 @@ namespace AZ
|
||||
const Name& passName = fullscreenTrianglePass->GetName();
|
||||
if (passName.GetStringView() == "CopyToSwapChain")
|
||||
{
|
||||
fullscreenTrianglePass->Invalidate();
|
||||
fullscreenTrianglePass->QueueForInitialization();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -137,7 +133,7 @@ namespace AZ
|
||||
}
|
||||
}
|
||||
|
||||
void DisplayMapperPass::BuildAttachmentsInternal()
|
||||
void DisplayMapperPass::BuildInternal()
|
||||
{
|
||||
const Name outputName = Name{ "Output" };
|
||||
Name inputPass = Name{ "Parent" };
|
||||
@@ -187,7 +183,21 @@ namespace AZ
|
||||
|
||||
m_swapChainAttachmentBinding = FindAttachmentBinding(Name("SwapChainOutput"));
|
||||
|
||||
ParentPass::BuildAttachmentsInternal();
|
||||
ParentPass::BuildInternal();
|
||||
}
|
||||
|
||||
void DisplayMapperPass::InitializeInternal()
|
||||
{
|
||||
// Force update on bindings because children of display mapper pass have their outputs connect to
|
||||
// their parent's output, which is a non-conventional and non-standard workflow. Parent outputs are
|
||||
// updated after child outputs, so post-build the child outputs do not yet point to the attachments on
|
||||
// the parent bindings they are connected to. Forcing this refresh sets the attachment on the child output.
|
||||
for (const RPI::Ptr<Pass>& child : m_children)
|
||||
{
|
||||
child->UpdateConnectedBindings();
|
||||
}
|
||||
|
||||
RPI::ParentPass::InitializeInternal();
|
||||
}
|
||||
|
||||
void DisplayMapperPass::FrameBeginInternal(FramePrepareParams params)
|
||||
@@ -199,24 +209,14 @@ namespace AZ
|
||||
void DisplayMapperPass::FrameEndInternal()
|
||||
{
|
||||
GetDisplayMapperConfiguration();
|
||||
if (m_needToRebuildChildren)
|
||||
{
|
||||
ClearChildren();
|
||||
BuildGradingLutTemplate();
|
||||
CreateGradingAndAcesPasses();
|
||||
}
|
||||
ParentPass::FrameEndInternal();
|
||||
}
|
||||
|
||||
void DisplayMapperPass::CreateChildPassesInternal()
|
||||
{
|
||||
if (m_needToRebuildChildren)
|
||||
{
|
||||
ClearChildren();
|
||||
BuildGradingLutTemplate();
|
||||
CreateGradingAndAcesPasses();
|
||||
}
|
||||
ParentPass::CreateChildPassesInternal();
|
||||
ClearChildren();
|
||||
BuildGradingLutTemplate();
|
||||
CreateGradingAndAcesPasses();
|
||||
}
|
||||
|
||||
AZStd::shared_ptr<RPI::PassTemplate> CreatePassTemplateHelper(
|
||||
@@ -485,7 +485,6 @@ namespace AZ
|
||||
{
|
||||
AddChild(m_ldrGradingLookupTablePass);
|
||||
}
|
||||
m_needToRebuildChildren = false;
|
||||
}
|
||||
|
||||
void DisplayMapperPass::GetDisplayMapperConfiguration()
|
||||
@@ -513,7 +512,8 @@ namespace AZ
|
||||
desc.m_ldrColorGradingLut != m_displayMapperConfigurationDescriptor.m_ldrColorGradingLut ||
|
||||
desc.m_acesParameterOverrides.m_overrideDefaults != m_displayMapperConfigurationDescriptor.m_acesParameterOverrides.m_overrideDefaults)
|
||||
{
|
||||
m_needToRebuildChildren = true;
|
||||
m_flags.m_createChildren = true;
|
||||
QueueForBuildAndInitialization();
|
||||
}
|
||||
m_displayMapperConfigurationDescriptor = desc;
|
||||
}
|
||||
@@ -527,41 +527,15 @@ namespace AZ
|
||||
|
||||
void DisplayMapperPass::ClearChildren()
|
||||
{
|
||||
if (m_acesOutputTransformPass)
|
||||
{
|
||||
RemoveChild(m_acesOutputTransformPass);
|
||||
m_acesOutputTransformPass = nullptr;
|
||||
}
|
||||
if (m_bakeAcesOutputTransformLutPass)
|
||||
{
|
||||
RemoveChild(m_bakeAcesOutputTransformLutPass);
|
||||
m_bakeAcesOutputTransformLutPass = nullptr;
|
||||
}
|
||||
if (m_acesOutputTransformLutPass)
|
||||
{
|
||||
RemoveChild(m_acesOutputTransformLutPass);
|
||||
m_acesOutputTransformLutPass = nullptr;
|
||||
}
|
||||
if (m_displayMapperPassthroughPass)
|
||||
{
|
||||
RemoveChild(m_displayMapperPassthroughPass);
|
||||
m_displayMapperPassthroughPass = nullptr;
|
||||
}
|
||||
if (m_displayMapperOnlyGammaCorrectionPass)
|
||||
{
|
||||
RemoveChild(m_displayMapperOnlyGammaCorrectionPass);
|
||||
m_displayMapperOnlyGammaCorrectionPass = nullptr;
|
||||
}
|
||||
if (m_ldrGradingLookupTablePass)
|
||||
{
|
||||
RemoveChild(m_ldrGradingLookupTablePass);
|
||||
m_ldrGradingLookupTablePass = nullptr;
|
||||
}
|
||||
if (m_outputTransformPass)
|
||||
{
|
||||
RemoveChild(m_outputTransformPass);
|
||||
m_outputTransformPass = nullptr;
|
||||
}
|
||||
RemoveChildren();
|
||||
|
||||
m_acesOutputTransformPass = nullptr;
|
||||
m_bakeAcesOutputTransformLutPass = nullptr;
|
||||
m_acesOutputTransformLutPass = nullptr;
|
||||
m_displayMapperPassthroughPass = nullptr;
|
||||
m_displayMapperOnlyGammaCorrectionPass = nullptr;
|
||||
m_ldrGradingLookupTablePass = nullptr;
|
||||
m_outputTransformPass = nullptr;
|
||||
}
|
||||
} // namespace Render
|
||||
} // namespace AZ
|
||||
|
||||
@@ -39,9 +39,9 @@ namespace AZ
|
||||
{
|
||||
}
|
||||
|
||||
void OutputTransformPass::Init()
|
||||
void OutputTransformPass::InitializeInternal()
|
||||
{
|
||||
DisplayMapperFullScreenPass::Init();
|
||||
DisplayMapperFullScreenPass::InitializeInternal();
|
||||
|
||||
AZ_Assert(m_shaderResourceGroup != nullptr, "OutputTransformPass %s has a null shader resource group when calling Init.", GetPathName().GetCStr());
|
||||
|
||||
|
||||
@@ -519,13 +519,13 @@ namespace AZ
|
||||
io.Fonts->TexID = reinterpret_cast<ImTextureID>(m_fontAtlas.get());
|
||||
}
|
||||
|
||||
void ImGuiPass::OnBuildAttachmentsFinishedInternal()
|
||||
void ImGuiPass::InitializeInternal()
|
||||
{
|
||||
// Set output format and finalize pipeline state
|
||||
m_pipelineState->SetOutputFromPass(this);
|
||||
m_pipelineState->Finalize();
|
||||
|
||||
Base::OnBuildAttachmentsFinishedInternal();
|
||||
Base::InitializeInternal();
|
||||
}
|
||||
|
||||
void ImGuiPass::SetupFrameGraphDependencies(RHI::FrameGraphInterface frameGraph)
|
||||
|
||||
@@ -94,7 +94,7 @@ namespace AZ
|
||||
explicit ImGuiPass(const RPI::PassDescriptor& descriptor);
|
||||
|
||||
// Pass Behaviour Overrides...
|
||||
void OnBuildAttachmentsFinishedInternal() override;
|
||||
void InitializeInternal() override;
|
||||
void FrameBeginInternal(FramePrepareParams params) override;
|
||||
|
||||
// Scope producer functions
|
||||
|
||||
@@ -28,8 +28,6 @@ namespace AZ
|
||||
LuxCoreTexturePass::LuxCoreTexturePass(const RPI::PassDescriptor& descriptor)
|
||||
: ParentPass(descriptor)
|
||||
{
|
||||
m_flags.m_alreadyCreated = false;
|
||||
|
||||
RPI::PassSystemInterface* passSystem = RPI::PassSystemInterface::Get();
|
||||
|
||||
// Create render target pass
|
||||
@@ -41,8 +39,6 @@ namespace AZ
|
||||
|
||||
// Create readback
|
||||
m_readback = AZStd::make_shared<AZ::RPI::AttachmentReadback>(AZ::RHI::ScopeId{ Uuid::CreateRandom().ToString<AZStd::string>() });
|
||||
|
||||
CreateChildPasses();
|
||||
}
|
||||
|
||||
LuxCoreTexturePass::~LuxCoreTexturePass()
|
||||
@@ -61,9 +57,9 @@ namespace AZ
|
||||
AddChild(m_renderTargetPass);
|
||||
}
|
||||
|
||||
void LuxCoreTexturePass::BuildAttachmentsInternal()
|
||||
void LuxCoreTexturePass::BuildInternal()
|
||||
{
|
||||
ParentPass::BuildAttachmentsInternal();
|
||||
ParentPass::BuildInternal();
|
||||
}
|
||||
|
||||
void LuxCoreTexturePass::FrameBeginInternal(FramePrepareParams params)
|
||||
|
||||
@@ -38,13 +38,13 @@ namespace AZ
|
||||
m_attachmentSize = image->GetRHIImage()->GetDescriptor().m_size;
|
||||
m_attachmentFormat = format;
|
||||
m_shaderResourceGroup->SetImage(m_textureIndex, image);
|
||||
QueueForBuildAttachments();
|
||||
QueueForBuildAndInitialization();
|
||||
}
|
||||
|
||||
void RenderTexturePass::BuildAttachmentsInternal()
|
||||
void RenderTexturePass::BuildInternal()
|
||||
{
|
||||
UpdataAttachment();
|
||||
FullscreenTrianglePass::BuildAttachmentsInternal();
|
||||
FullscreenTrianglePass::BuildInternal();
|
||||
}
|
||||
|
||||
void RenderTexturePass::FrameBeginInternal(FramePrepareParams params)
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace AZ
|
||||
m_skinnedMeshFeatureProcessor = skinnedMeshFeatureProcessor;
|
||||
}
|
||||
|
||||
void MorphTargetComputePass::BuildAttachmentsInternal()
|
||||
void MorphTargetComputePass::BuildInternal()
|
||||
{
|
||||
// The same buffer that skinning writes to is used to manage the computed vertex deltas that are passed from the
|
||||
// morph target pass to the skinning pass. This simplifies things by only requiring one class to manage the memory
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace AZ
|
||||
|
||||
void SetFeatureProcessor(SkinnedMeshFeatureProcessor* m_skinnedMeshFeatureProcessor);
|
||||
private:
|
||||
void BuildAttachmentsInternal() override;
|
||||
void BuildInternal() override;
|
||||
void BuildCommandListInternal(const RHI::FrameGraphExecuteContext& context) override;
|
||||
|
||||
SkinnedMeshFeatureProcessor* m_skinnedMeshFeatureProcessor = nullptr;
|
||||
|
||||
@@ -43,14 +43,9 @@ namespace AZ
|
||||
ReleaseLutImage();
|
||||
}
|
||||
|
||||
void BlendColorGradingLutsPass::FrameBeginInternal(FramePrepareParams params)
|
||||
void BlendColorGradingLutsPass::InitializeInternal()
|
||||
{
|
||||
if (!m_flags.m_initialized)
|
||||
{
|
||||
Init();
|
||||
}
|
||||
|
||||
ComputePass::FrameBeginInternal(params);
|
||||
InitializeShaderVariant();
|
||||
}
|
||||
|
||||
void BlendColorGradingLutsPass::InitializeShaderVariant()
|
||||
@@ -106,12 +101,6 @@ namespace AZ
|
||||
m_needToUpdateShaderVariant = false;
|
||||
}
|
||||
|
||||
void BlendColorGradingLutsPass::Init()
|
||||
{
|
||||
InitializeShaderVariant();
|
||||
m_flags.m_initialized = true;
|
||||
}
|
||||
|
||||
void BlendColorGradingLutsPass::SetupFrameGraphDependencies(RHI::FrameGraphInterface frameGraph)
|
||||
{
|
||||
ComputePass::SetupFrameGraphDependencies(frameGraph);
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace AZ
|
||||
explicit BlendColorGradingLutsPass(const RPI::PassDescriptor& descriptor);
|
||||
|
||||
// Pass behavior overrides...
|
||||
void FrameBeginInternal(FramePrepareParams params) override;
|
||||
void InitializeInternal() override;
|
||||
|
||||
// Scope producer functions...
|
||||
void SetupFrameGraphDependencies(RHI::FrameGraphInterface frameGraph) override;
|
||||
@@ -66,8 +66,6 @@ namespace AZ
|
||||
void InitializeShaderVariant();
|
||||
void UpdateCurrentShaderVariant();
|
||||
|
||||
void Init();
|
||||
|
||||
void AcquireLutImage();
|
||||
void ReleaseLutImage();
|
||||
|
||||
|
||||
@@ -252,10 +252,10 @@ namespace AZ
|
||||
}
|
||||
}
|
||||
|
||||
void BloomBlurPass::BuildAttachmentsInternal()
|
||||
void BloomBlurPass::BuildInternal()
|
||||
{
|
||||
BuildChildPasses();
|
||||
ParentPass::BuildAttachmentsInternal();
|
||||
ParentPass::BuildInternal();
|
||||
}
|
||||
|
||||
void BloomBlurPass::FrameBeginInternal(FramePrepareParams params)
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace AZ
|
||||
BloomBlurPass(const RPI::PassDescriptor& descriptor);
|
||||
|
||||
// Pass behaviour overrides...
|
||||
void BuildAttachmentsInternal() override;
|
||||
void BuildInternal() override;
|
||||
void FrameBeginInternal(FramePrepareParams params) override;
|
||||
|
||||
void GetInputInfo();
|
||||
|
||||
@@ -56,10 +56,10 @@ namespace AZ
|
||||
m_passData = *passData;
|
||||
}
|
||||
|
||||
void BloomCompositePass::BuildAttachmentsInternal()
|
||||
void BloomCompositePass::BuildInternal()
|
||||
{
|
||||
BuildChildPasses();
|
||||
ParentPass::BuildAttachmentsInternal();
|
||||
ParentPass::BuildInternal();
|
||||
}
|
||||
|
||||
void BloomCompositePass::FrameBeginInternal(FramePrepareParams params)
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace AZ
|
||||
BloomCompositePass(const RPI::PassDescriptor& descriptor);
|
||||
|
||||
// Pass behaviour overrides...
|
||||
void BuildAttachmentsInternal() override;
|
||||
void BuildInternal() override;
|
||||
void FrameBeginInternal(FramePrepareParams params) override;
|
||||
|
||||
void GetAttachmentInfo();
|
||||
|
||||
@@ -74,10 +74,10 @@ namespace AZ
|
||||
AddAttachmentBinding(outBinding);
|
||||
}
|
||||
|
||||
ComputePass::BuildAttachmentsInternal();
|
||||
ComputePass::BuildInternal();
|
||||
}
|
||||
|
||||
void BloomDownsamplePass::BuildAttachmentsInternal()
|
||||
void BloomDownsamplePass::BuildInternal()
|
||||
{
|
||||
BuildOutAttachmentBinding();
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace AZ
|
||||
BloomDownsamplePass(const RPI::PassDescriptor& descriptor);
|
||||
|
||||
// Pass Behaviour Overrides...
|
||||
void BuildAttachmentsInternal() override;
|
||||
void BuildInternal() override;
|
||||
void FrameBeginInternal(FramePrepareParams params) override;
|
||||
|
||||
void BuildOutAttachmentBinding();
|
||||
|
||||
@@ -43,9 +43,9 @@ namespace AZ
|
||||
{
|
||||
}
|
||||
|
||||
void DepthOfFieldBokehBlurPass::Init()
|
||||
void DepthOfFieldBokehBlurPass::InitializeInternal()
|
||||
{
|
||||
FullscreenTrianglePass::Init();
|
||||
FullscreenTrianglePass::InitializeInternal();
|
||||
|
||||
m_sampleNumberIndex.Reset();
|
||||
m_radiusMinIndex.Reset();
|
||||
|
||||
@@ -39,11 +39,11 @@ namespace AZ
|
||||
|
||||
protected:
|
||||
// Behaviour functions override...
|
||||
void InitializeInternal() override;
|
||||
void FrameBeginInternal(FramePrepareParams params) override;
|
||||
|
||||
private:
|
||||
DepthOfFieldBokehBlurPass(const RPI::PassDescriptor& descriptor);
|
||||
void Init() override;
|
||||
void InitializeShaderVariant();
|
||||
void UpdateCurrentShaderVariant();
|
||||
|
||||
|
||||
@@ -40,9 +40,9 @@ namespace AZ
|
||||
{
|
||||
}
|
||||
|
||||
void DepthOfFieldCompositePass::Init()
|
||||
void DepthOfFieldCompositePass::InitializeInternal()
|
||||
{
|
||||
FullscreenTrianglePass::Init();
|
||||
FullscreenTrianglePass::InitializeInternal();
|
||||
|
||||
m_backBlendFactorDivision2Index.Reset();
|
||||
m_backBlendFactorDivision4Index.Reset();
|
||||
|
||||
@@ -37,11 +37,11 @@ namespace AZ
|
||||
|
||||
protected:
|
||||
// Pass behavior overrides...
|
||||
void InitializeInternal() override;
|
||||
void FrameBeginInternal(FramePrepareParams params) override;
|
||||
|
||||
private:
|
||||
DepthOfFieldCompositePass(const RPI::PassDescriptor& descriptor);
|
||||
void Init() override;
|
||||
void InitializeShaderVariant();
|
||||
void UpdateCurrentShaderVariant();
|
||||
|
||||
|
||||
+1
-1
@@ -52,7 +52,7 @@ namespace AZ
|
||||
return depth;
|
||||
}
|
||||
|
||||
void DepthOfFieldCopyFocusDepthToCpuPass::BuildAttachmentsInternal()
|
||||
void DepthOfFieldCopyFocusDepthToCpuPass::BuildInternal()
|
||||
{
|
||||
SetScopeId(RHI::ScopeId(GetPathName()));
|
||||
}
|
||||
|
||||
+1
-1
@@ -48,7 +48,7 @@ namespace AZ
|
||||
void BuildCommandList(const RHI::FrameGraphExecuteContext& context) override;
|
||||
|
||||
// Pass overrides
|
||||
void BuildAttachmentsInternal() override;
|
||||
void BuildInternal() override;
|
||||
void FrameBeginInternal(FramePrepareParams params) override;
|
||||
|
||||
RPI::Ptr<RPI::Buffer> m_bufferRef;
|
||||
|
||||
@@ -33,9 +33,9 @@ namespace AZ
|
||||
{
|
||||
}
|
||||
|
||||
void DepthOfFieldMaskPass::Init()
|
||||
void DepthOfFieldMaskPass::InitializeInternal()
|
||||
{
|
||||
FullscreenTrianglePass::Init();
|
||||
FullscreenTrianglePass::InitializeInternal();
|
||||
|
||||
m_blendFactorIndex.Reset();
|
||||
m_inputResolutionInverseIndex.Reset();
|
||||
|
||||
@@ -37,11 +37,11 @@ namespace AZ
|
||||
|
||||
protected:
|
||||
// Pass behavior overrides...
|
||||
void InitializeInternal() override;
|
||||
void FrameBeginInternal(FramePrepareParams params) override;
|
||||
|
||||
private:
|
||||
DepthOfFieldMaskPass(const RPI::PassDescriptor& descriptor);
|
||||
virtual void Init() override;
|
||||
|
||||
// SRG binding indices...
|
||||
RHI::ShaderInputNameIndex m_blendFactorIndex = "m_blendFactor";
|
||||
|
||||
+18
-15
@@ -34,18 +34,6 @@ namespace AZ
|
||||
DepthOfFieldReadBackFocusDepthPass::DepthOfFieldReadBackFocusDepthPass(const RPI::PassDescriptor& descriptor)
|
||||
: ParentPass(descriptor)
|
||||
{
|
||||
RPI::PassSystemInterface* passSystem = RPI::PassSystemInterface::Get();
|
||||
|
||||
// Create read back pass
|
||||
m_readbackPass = passSystem->CreatePass<DepthOfFieldCopyFocusDepthToCpuPass>(AZ::Name("DepthOfFieldReadBackPass"));
|
||||
AZ_Assert(m_readbackPass, "DepthOfFieldReadBackFocusDepthPass : read back pass is invalid");
|
||||
|
||||
AddChild(m_readbackPass);
|
||||
|
||||
// Find GetDepth pass on template
|
||||
auto pass = FindChildPass(Name("DepthOfFieldWriteFocusDepthFromGpu"));
|
||||
m_getDepthPass = static_cast<DepthOfFieldWriteFocusDepthFromGpuPass*>(pass.get());
|
||||
|
||||
// Create buffer for read back focus depth. We append static counter to avoid name conflicts.
|
||||
RPI::CommonBufferDescriptor desc;
|
||||
desc.m_bufferName = "DepthOfFieldReadBackAutoFocusDepthBuffer";
|
||||
@@ -55,9 +43,6 @@ namespace AZ
|
||||
desc.m_bufferData = nullptr;
|
||||
desc.m_elementFormat = RHI::Format::R32_FLOAT;
|
||||
m_buffer = RPI::BufferSystemInterface::Get()->CreateBufferFromCommonPool(desc);
|
||||
|
||||
m_getDepthPass->SetBufferRef(m_buffer);
|
||||
m_readbackPass->SetBufferRef(m_buffer);
|
||||
}
|
||||
|
||||
DepthOfFieldReadBackFocusDepthPass::~DepthOfFieldReadBackFocusDepthPass()
|
||||
@@ -85,6 +70,24 @@ namespace AZ
|
||||
}
|
||||
}
|
||||
|
||||
void DepthOfFieldReadBackFocusDepthPass::CreateChildPassesInternal()
|
||||
{
|
||||
RPI::PassSystemInterface* passSystem = RPI::PassSystemInterface::Get();
|
||||
|
||||
// Create read back pass
|
||||
m_readbackPass = passSystem->CreatePass<DepthOfFieldCopyFocusDepthToCpuPass>(AZ::Name("DepthOfFieldReadBackPass"));
|
||||
AZ_Assert(m_readbackPass, "DepthOfFieldReadBackFocusDepthPass : read back pass is invalid");
|
||||
|
||||
AddChild(m_readbackPass);
|
||||
|
||||
// Find GetDepth pass on template
|
||||
auto pass = FindChildPass(Name("DepthOfFieldWriteFocusDepthFromGpu"));
|
||||
m_getDepthPass = static_cast<DepthOfFieldWriteFocusDepthFromGpuPass*>(pass.get());
|
||||
|
||||
m_getDepthPass->SetBufferRef(m_buffer);
|
||||
m_readbackPass->SetBufferRef(m_buffer);
|
||||
}
|
||||
|
||||
void DepthOfFieldReadBackFocusDepthPass::FrameBeginInternal(FramePrepareParams params)
|
||||
{
|
||||
RPI::Scene* scene = GetScene();
|
||||
|
||||
+1
@@ -43,6 +43,7 @@ namespace AZ
|
||||
|
||||
protected:
|
||||
// Pass behavior overrides...
|
||||
void CreateChildPassesInternal() override;
|
||||
void FrameBeginInternal(FramePrepareParams params) override;
|
||||
|
||||
private:
|
||||
|
||||
+2
-2
@@ -62,9 +62,9 @@ namespace AZ
|
||||
m_bufferRef = bufferRef;
|
||||
}
|
||||
|
||||
void DepthOfFieldWriteFocusDepthFromGpuPass::BuildAttachmentsInternal()
|
||||
void DepthOfFieldWriteFocusDepthFromGpuPass::BuildInternal()
|
||||
{
|
||||
AZ_Assert(m_bufferRef != nullptr, "%s has a null buffer when calling BuildAttachmentsInternal.", GetPathName().GetCStr());
|
||||
AZ_Assert(m_bufferRef != nullptr, "%s has a null buffer when calling BuildInternal.", GetPathName().GetCStr());
|
||||
|
||||
AttachBufferToSlot(Name("DofDepthInputOutput"), m_bufferRef);
|
||||
}
|
||||
|
||||
+1
-1
@@ -51,7 +51,7 @@ namespace AZ
|
||||
void CompileResources(const RHI::FrameGraphCompileContext& context) override;
|
||||
|
||||
// Pass overrides
|
||||
void BuildAttachmentsInternal() override;
|
||||
void BuildInternal() override;
|
||||
};
|
||||
} // namespace Render
|
||||
} // namespace AZ
|
||||
|
||||
@@ -60,7 +60,7 @@ namespace AZ
|
||||
m_buffer = RPI::BufferSystemInterface::Get()->CreateBufferFromCommonPool(desc);
|
||||
}
|
||||
|
||||
void EyeAdaptationPass::BuildAttachmentsInternal()
|
||||
void EyeAdaptationPass::BuildInternal()
|
||||
{
|
||||
if (!m_buffer)
|
||||
{
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace AZ
|
||||
float m_exposureValue = 1.0f;
|
||||
};
|
||||
|
||||
void BuildAttachmentsInternal() override;
|
||||
void BuildInternal() override;
|
||||
|
||||
void FrameBeginInternal(FramePrepareParams params) override;
|
||||
|
||||
|
||||
+2
-2
@@ -48,9 +48,9 @@ namespace AZ
|
||||
}
|
||||
}
|
||||
|
||||
void LookModificationCompositePass::Init()
|
||||
void LookModificationCompositePass::InitializeInternal()
|
||||
{
|
||||
FullscreenTrianglePass::Init();
|
||||
FullscreenTrianglePass::InitializeInternal();
|
||||
|
||||
m_shaderColorGradingLutImageIndex.Reset();
|
||||
m_shaderColorGradingShaperTypeIndex.Reset();
|
||||
|
||||
@@ -60,9 +60,9 @@ namespace AZ
|
||||
|
||||
protected:
|
||||
LookModificationCompositePass(const RPI::PassDescriptor& descriptor);
|
||||
void Init() override;
|
||||
|
||||
//! Pass behavior overrides
|
||||
void InitializeInternal() override;
|
||||
void FrameBeginInternal(FramePrepareParams params) final;
|
||||
|
||||
private:
|
||||
|
||||
+2
-2
@@ -36,10 +36,10 @@ namespace AZ
|
||||
&AzFramework::WindowSystemRequestBus::Events::GetDefaultWindowHandle);
|
||||
}
|
||||
|
||||
void LookModificationPass::BuildAttachmentsInternal()
|
||||
void LookModificationPass::BuildInternal()
|
||||
{
|
||||
m_swapChainAttachmentBinding = FindAttachmentBinding(Name("SwapChainOutput"));
|
||||
ParentPass::BuildAttachmentsInternal();
|
||||
ParentPass::BuildInternal();
|
||||
}
|
||||
|
||||
void LookModificationPass::FrameBeginInternal([[maybe_unused]] FramePrepareParams params)
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace AZ
|
||||
//! Pass overrides ...
|
||||
void FrameBeginInternal(FramePrepareParams params) override;
|
||||
|
||||
void BuildAttachmentsInternal() override;
|
||||
void BuildInternal() override;
|
||||
|
||||
private:
|
||||
const RPI::PassAttachmentBinding* m_swapChainAttachmentBinding = nullptr;
|
||||
|
||||
+1
-1
@@ -81,7 +81,7 @@ namespace AZ
|
||||
return colorBuffer->m_descriptor.m_image.m_size;
|
||||
}
|
||||
|
||||
void LuminanceHistogramGeneratorPass::BuildAttachmentsInternal()
|
||||
void LuminanceHistogramGeneratorPass::BuildInternal()
|
||||
{
|
||||
CreateHistogramBuffer();
|
||||
AttachHistogramBuffer();
|
||||
|
||||
+1
-1
@@ -42,7 +42,7 @@ namespace AZ
|
||||
|
||||
protected:
|
||||
LuminanceHistogramGeneratorPass(const RPI::PassDescriptor& descriptor);
|
||||
virtual void BuildAttachmentsInternal() override;
|
||||
virtual void BuildInternal() override;
|
||||
void CreateHistogramBuffer();
|
||||
void AttachHistogramBuffer();
|
||||
AZ::RHI::Size GetColorBufferResolution();
|
||||
|
||||
@@ -43,9 +43,9 @@ namespace AZ
|
||||
{
|
||||
}
|
||||
|
||||
void SMAABasePass::Init()
|
||||
void SMAABasePass::InitializeInternal()
|
||||
{
|
||||
FullscreenTrianglePass::Init();
|
||||
FullscreenTrianglePass::InitializeInternal();
|
||||
|
||||
AZ_Assert(m_shaderResourceGroup != nullptr, "SMAABasePass %s has a null shader resource group when calling Init.", GetPathName().GetCStr());
|
||||
|
||||
|
||||
@@ -41,9 +41,12 @@ namespace AZ
|
||||
protected:
|
||||
SMAABasePass(const RPI::PassDescriptor& descriptor);
|
||||
|
||||
void Init() override;
|
||||
// Pass behavior overrides...
|
||||
void InitializeInternal() override;
|
||||
|
||||
// An interface to update pass srg.
|
||||
virtual void UpdateSRG() = 0;
|
||||
|
||||
// An interface to get current shader variation option.
|
||||
virtual void GetCurrentShaderOption(AZ::RPI::ShaderOptionGroup& shaderOption) const = 0;
|
||||
|
||||
|
||||
+2
-2
@@ -94,9 +94,9 @@ namespace AZ
|
||||
}
|
||||
}
|
||||
|
||||
void SMAABlendingWeightCalculationPass::Init()
|
||||
void SMAABlendingWeightCalculationPass::InitializeInternal()
|
||||
{
|
||||
SMAABasePass::Init();
|
||||
SMAABasePass::InitializeInternal();
|
||||
|
||||
AZ_Assert(m_shaderResourceGroup != nullptr, "SMAABlendingWeightCalculationPass %s has a null shader resource group when calling Init.", GetPathName().GetCStr());
|
||||
|
||||
|
||||
+3
-1
@@ -43,7 +43,9 @@ namespace AZ
|
||||
|
||||
private:
|
||||
SMAABlendingWeightCalculationPass(const RPI::PassDescriptor& descriptor);
|
||||
void Init() override;
|
||||
|
||||
// Pass behavior overrides...
|
||||
void InitializeInternal() override;
|
||||
|
||||
// SMAABasePass functions...
|
||||
void UpdateSRG() override;
|
||||
|
||||
@@ -48,9 +48,9 @@ namespace AZ
|
||||
{
|
||||
}
|
||||
|
||||
void SMAAEdgeDetectionPass::Init()
|
||||
void SMAAEdgeDetectionPass::InitializeInternal()
|
||||
{
|
||||
SMAABasePass::Init();
|
||||
SMAABasePass::InitializeInternal();
|
||||
|
||||
m_renderTargetMetricsShaderInputIndex.Reset();
|
||||
m_chromaThresholdShaderInputIndex.Reset();
|
||||
|
||||
@@ -45,7 +45,9 @@ namespace AZ
|
||||
|
||||
private:
|
||||
SMAAEdgeDetectionPass(const RPI::PassDescriptor& descriptor);
|
||||
void Init() override;
|
||||
|
||||
// Pass behavior overrides
|
||||
void InitializeInternal() override;
|
||||
|
||||
// SMAABasePass functions...
|
||||
void UpdateSRG() override;
|
||||
|
||||
+2
-2
@@ -47,9 +47,9 @@ namespace AZ
|
||||
{
|
||||
}
|
||||
|
||||
void SMAANeighborhoodBlendingPass::Init()
|
||||
void SMAANeighborhoodBlendingPass::InitializeInternal()
|
||||
{
|
||||
SMAABasePass::Init();
|
||||
SMAABasePass::InitializeInternal();
|
||||
m_renderTargetMetricsShaderInputIndex.Reset();
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,9 @@ namespace AZ
|
||||
|
||||
private:
|
||||
SMAANeighborhoodBlendingPass(const RPI::PassDescriptor& descriptor);
|
||||
void Init() override;
|
||||
|
||||
// Pass behavior overrides
|
||||
void InitializeInternal() override;
|
||||
|
||||
// SMAABasePass functions...
|
||||
void UpdateSRG() override;
|
||||
|
||||
@@ -41,9 +41,9 @@ namespace AZ
|
||||
return ParentPass::IsEnabled();
|
||||
}
|
||||
|
||||
void SsaoParentPass::OnBuildAttachmentsFinishedInternal()
|
||||
void SsaoParentPass::InitializeInternal()
|
||||
{
|
||||
ParentPass::OnBuildAttachmentsFinishedInternal();
|
||||
ParentPass::InitializeInternal();
|
||||
|
||||
m_blurParentPass = FindChildPass(Name("SsaoBlur"))->AsParent();
|
||||
AZ_Assert(m_blurParentPass, "[SsaoParentPass] Could not retrieve parent blur pass.");
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace AZ
|
||||
|
||||
protected:
|
||||
// Behavior functions override...
|
||||
void OnBuildAttachmentsFinishedInternal() override;
|
||||
void InitializeInternal() override;
|
||||
void FrameBeginInternal(FramePrepareParams params) override;
|
||||
|
||||
private:
|
||||
|
||||
@@ -108,7 +108,7 @@ namespace AZ::Render
|
||||
Base::ResetInternal();
|
||||
}
|
||||
|
||||
void TaaPass::BuildAttachmentsInternal()
|
||||
void TaaPass::BuildInternal()
|
||||
{
|
||||
m_accumulationAttachments[0] = FindAttachment(Name("Accumulation1"));
|
||||
m_accumulationAttachments[1] = FindAttachment(Name("Accumulation2"));
|
||||
@@ -143,7 +143,7 @@ namespace AZ::Render
|
||||
m_outputColorBinding->SetAttachment(m_accumulationAttachments[1]);
|
||||
}
|
||||
|
||||
Base::BuildAttachmentsInternal();
|
||||
Base::BuildInternal();
|
||||
}
|
||||
|
||||
void TaaPass::UpdateAttachmentImage(RPI::Ptr<RPI::PassAttachment>& attachment)
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace AZ::Render
|
||||
// Pass behavior overrides...
|
||||
void FrameBeginInternal(FramePrepareParams params) override;
|
||||
void ResetInternal() override;
|
||||
void BuildAttachmentsInternal() override;
|
||||
void BuildInternal() override;
|
||||
|
||||
void UpdateAttachmentImage(RPI::Ptr<RPI::PassAttachment>& attachment);
|
||||
|
||||
|
||||
+1
-1
@@ -42,7 +42,7 @@ namespace AZ
|
||||
}
|
||||
}
|
||||
|
||||
void RayTracingAccelerationStructurePass::BuildAttachmentsInternal()
|
||||
void RayTracingAccelerationStructurePass::BuildInternal()
|
||||
{
|
||||
SetScopeId(RHI::ScopeId(GetPathName()));
|
||||
}
|
||||
|
||||
+1
-1
@@ -44,7 +44,7 @@ namespace AZ
|
||||
void BuildCommandList(const RHI::FrameGraphExecuteContext& context) override;
|
||||
|
||||
// Pass overrides
|
||||
void BuildAttachmentsInternal() override;
|
||||
void BuildInternal() override;
|
||||
void FrameBeginInternal(FramePrepareParams params) override;
|
||||
|
||||
// buffer view descriptor for the TLAS
|
||||
|
||||
+2
-2
@@ -30,7 +30,7 @@ namespace AZ
|
||||
{
|
||||
}
|
||||
|
||||
void ReflectionCopyFrameBufferPass::BuildAttachmentsInternal()
|
||||
void ReflectionCopyFrameBufferPass::BuildInternal()
|
||||
{
|
||||
RPI::PassHierarchyFilter passFilter(AZ::Name("ReflectionScreenSpaceBlurPass"));
|
||||
const AZStd::vector<RPI::Pass*>& passes = RPI::PassSystemInterface::Get()->FindPasses(passFilter);
|
||||
@@ -43,7 +43,7 @@ namespace AZ
|
||||
AttachImageToSlot(outputBinding.m_name, frameBufferAttachment);
|
||||
}
|
||||
|
||||
FullscreenTrianglePass::BuildAttachmentsInternal();
|
||||
FullscreenTrianglePass::BuildInternal();
|
||||
}
|
||||
} // namespace RPI
|
||||
} // namespace AZ
|
||||
|
||||
+1
-1
@@ -37,7 +37,7 @@ namespace AZ
|
||||
explicit ReflectionCopyFrameBufferPass(const RPI::PassDescriptor& descriptor);
|
||||
|
||||
// Pass Overrides...
|
||||
void BuildAttachmentsInternal() override;
|
||||
void BuildInternal() override;
|
||||
};
|
||||
} // namespace RPI
|
||||
} // namespace AZ
|
||||
|
||||
+7
-7
@@ -47,7 +47,7 @@ namespace AZ
|
||||
RemoveChildren();
|
||||
}
|
||||
|
||||
void ReflectionScreenSpaceBlurPass::CreateChildPasses(uint32_t numBlurMips)
|
||||
void ReflectionScreenSpaceBlurPass::CreateChildPassesInternal()
|
||||
{
|
||||
RPI::PassSystemInterface* passSystem = RPI::PassSystemInterface::Get();
|
||||
|
||||
@@ -83,7 +83,7 @@ namespace AZ
|
||||
horizontalBlurChildDesc.m_passTemplate = blurHorizontalPassTemplate;
|
||||
|
||||
// add child passes to perform the vertical and horizontal Gaussian blur for each roughness mip level
|
||||
for (uint32_t mip = 0; mip < numBlurMips; ++mip)
|
||||
for (uint32_t mip = 0; mip < m_numBlurMips; ++mip)
|
||||
{
|
||||
// create Vertical blur child passes
|
||||
{
|
||||
@@ -113,9 +113,10 @@ namespace AZ
|
||||
}
|
||||
}
|
||||
|
||||
void ReflectionScreenSpaceBlurPass::BuildAttachmentsInternal()
|
||||
void ReflectionScreenSpaceBlurPass::BuildInternal()
|
||||
{
|
||||
RemoveChildren();
|
||||
m_flags.m_createChildren = true;
|
||||
|
||||
Data::Instance<RPI::AttachmentImagePool> pool = RPI::ImageSystemInterface::Get()->GetSystemAttachmentPool();
|
||||
|
||||
@@ -163,12 +164,11 @@ namespace AZ
|
||||
m_ownedAttachments.push_back(transientPassAttachment);
|
||||
}
|
||||
|
||||
// create child passes, one vertical and one horizontal blur per mip level
|
||||
CreateChildPasses(mipLevels - 1);
|
||||
m_numBlurMips = mipLevels - 1;
|
||||
|
||||
// call ParentPass::BuildAttachmentsInternal() first to configure the slots and auto-add the empty bindings,
|
||||
// call ParentPass::BuildInternal() first to configure the slots and auto-add the empty bindings,
|
||||
// then we will assign attachments to the bindings
|
||||
ParentPass::BuildAttachmentsInternal();
|
||||
ParentPass::BuildInternal();
|
||||
|
||||
// setup attachment bindings on vertical blur child passes
|
||||
uint32_t attachmentIndex = 0;
|
||||
|
||||
+3
-2
@@ -40,16 +40,17 @@ namespace AZ
|
||||
private:
|
||||
explicit ReflectionScreenSpaceBlurPass(const RPI::PassDescriptor& descriptor);
|
||||
|
||||
void CreateChildPasses(uint32_t numBlurMips);
|
||||
void CreateChildPassesInternal() override;
|
||||
|
||||
// Pass Overrides...
|
||||
void ResetInternal() override;
|
||||
void BuildAttachmentsInternal() override;
|
||||
void BuildInternal() override;
|
||||
|
||||
AZStd::vector<RPI::Ptr<RPI::FullscreenTrianglePass>> m_verticalBlurChildPasses;
|
||||
AZStd::vector<RPI::Ptr<RPI::FullscreenTrianglePass>> m_horizontalBlurChildPasses;
|
||||
|
||||
Data::Instance<RPI::AttachmentImage> m_frameBufferImageAttachment;
|
||||
uint32_t m_numBlurMips = 0;
|
||||
};
|
||||
} // namespace RPI
|
||||
} // namespace AZ
|
||||
|
||||
@@ -46,9 +46,9 @@ namespace AZ
|
||||
}
|
||||
|
||||
|
||||
void DeferredFogPass::Init()
|
||||
void DeferredFogPass::InitializeInternal()
|
||||
{
|
||||
FullscreenTrianglePass::Init();
|
||||
FullscreenTrianglePass::InitializeInternal();
|
||||
|
||||
// The following will ensure that in the case of data driven pass, the settings will get
|
||||
// updated by the pass enable state.
|
||||
|
||||
@@ -43,13 +43,11 @@ namespace AZ
|
||||
{
|
||||
AZ_RPI_PASS(DeferredFogPass);
|
||||
|
||||
|
||||
public:
|
||||
AZ_RTTI(DeferredFogPass, "{0406C8AB-E95D-43A7-AF53-BDEE22D36746}", RPI::FullscreenTrianglePass);
|
||||
AZ_CLASS_ALLOCATOR(DeferredFogPass, SystemAllocator, 0);
|
||||
~DeferredFogPass() = default;
|
||||
|
||||
void Init() override;
|
||||
|
||||
static RPI::Ptr<DeferredFogPass> Create(const RPI::PassDescriptor& descriptor);
|
||||
|
||||
@@ -57,12 +55,16 @@ namespace AZ
|
||||
|
||||
virtual bool IsEnabled() const override;
|
||||
|
||||
void SetupFrameGraphDependencies(RHI::FrameGraphInterface frameGraph) override;
|
||||
void CompileResources(const RHI::FrameGraphCompileContext& context) override;
|
||||
|
||||
protected:
|
||||
DeferredFogPass(const RPI::PassDescriptor& descriptor);
|
||||
|
||||
// Pass behavior overrides...
|
||||
void InitializeInternal() override;
|
||||
|
||||
// Scope producer functions...
|
||||
void SetupFrameGraphDependencies(RHI::FrameGraphInterface frameGraph) override;
|
||||
void CompileResources(const RHI::FrameGraphCompileContext& context) override;
|
||||
|
||||
//! Set the binding indices of all members of the SRG
|
||||
void SetSrgBindIndices();
|
||||
|
||||
|
||||
@@ -526,7 +526,7 @@ namespace AZ::Render
|
||||
|
||||
for (EsmShadowmapsPass* esmPass : m_esmShadowmapsPasses)
|
||||
{
|
||||
esmPass->QueueForBuildAttachments();
|
||||
esmPass->QueueForBuildAndInitialization();
|
||||
}
|
||||
|
||||
for (ProjectedShadowmapsPass* shadowPass : m_projectedShadowmapsPasses)
|
||||
|
||||
@@ -99,7 +99,7 @@ namespace AZ
|
||||
void DecomposeExecute(const RHI::FrameGraphExecuteContext& context);
|
||||
|
||||
// copy data from the read back buffer (m_readbackBuffer) to the data buffer (m_dataBuffer)
|
||||
void CopyBufferData(uint32_t readbackBufferIndex);
|
||||
bool CopyBufferData(uint32_t readbackBufferIndex);
|
||||
|
||||
// Get read back data in a structure
|
||||
ReadbackResult GetReadbackResult() const;
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace AZ
|
||||
void CopyImageToBuffer(const RHI::FrameGraphCompileContext& context);
|
||||
|
||||
// Pass behavior overrides
|
||||
void BuildAttachmentsInternal() override;
|
||||
void BuildInternal() override;
|
||||
|
||||
// Scope producer functions...
|
||||
void SetupFrameGraphDependencies(RHI::FrameGraphInterface frameGraph) override;
|
||||
|
||||
@@ -44,14 +44,11 @@ namespace AZ
|
||||
//! Creates a FullscreenTrianglePass
|
||||
static Ptr<FullscreenTrianglePass> Create(const PassDescriptor& descriptor);
|
||||
|
||||
// Clears the initialized flag so that the next time PrepareFrameInternal is called, it will update the pipeline state
|
||||
void Invalidate();
|
||||
|
||||
protected:
|
||||
FullscreenTrianglePass(const PassDescriptor& descriptor);
|
||||
virtual void Init();
|
||||
|
||||
// Pass behavior overrides...
|
||||
void InitializeInternal() override;
|
||||
void FrameBeginInternal(FramePrepareParams params) override;
|
||||
|
||||
RHI::Viewport m_viewportState;
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace AZ
|
||||
MSAAResolvePass(const PassDescriptor& descriptor);
|
||||
|
||||
// Pass behavior overrides...
|
||||
void BuildAttachmentsInternal() override;
|
||||
void BuildInternal() override;
|
||||
void FrameBeginInternal(FramePrepareParams params) override;
|
||||
|
||||
private:
|
||||
|
||||
@@ -109,15 +109,16 @@ namespace AZ
|
||||
// --- Pass Behaviour Overrides ---
|
||||
|
||||
void ResetInternal() override;
|
||||
void BuildAttachmentsInternal() override;
|
||||
void OnBuildAttachmentsFinishedInternal() override;
|
||||
void BuildInternal() override;
|
||||
void OnInitializationFinishedInternal() override;
|
||||
void InitializeInternal() override;
|
||||
void FrameBeginInternal(FramePrepareParams params) override;
|
||||
void FrameEndInternal() override;
|
||||
|
||||
// Finds the pass in m_children and removes it
|
||||
void RemoveChild(Ptr<Pass> pass);
|
||||
|
||||
// Orphans all children from clearing m_children.
|
||||
// Orphans all children by clearing m_children.
|
||||
void RemoveChildren();
|
||||
|
||||
private:
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
friend class PassSystem; \
|
||||
friend class PassFactory; \
|
||||
friend class ParentPass; \
|
||||
friend class RenderPipeline; \
|
||||
friend class UnitTest::PassTests; \
|
||||
|
||||
namespace UnitTest
|
||||
@@ -78,9 +79,9 @@ namespace AZ
|
||||
//!
|
||||
//! When authoring a new pass class, inherit from Pass and override any of the virtual functions
|
||||
//! ending with 'Internal' to define the behavior of your passes. These virtual are recursively
|
||||
//! called in Preorder order throughout the pass tree. Only FramePrepare and FrameEnd are
|
||||
//! called in preorder traversal throughout the pass tree. Only FrameBegin and FrameEnd are
|
||||
//! guaranteed to be called per frame. The other override-able functions are called as needed
|
||||
//! when scheduled with the PassSystem. See QueueForBuildAttachments and QueueForRemoval.
|
||||
//! when scheduled with the PassSystem. See QueueForBuildAndInitialization, QueueForRemoval and QueueForInitialization.
|
||||
//!
|
||||
//! Passes are created by the PassFactory. They can be created using either Pass Name,
|
||||
//! a PassTemplate, or a PassRequest. To register your pass class with the PassFactory,
|
||||
@@ -153,11 +154,14 @@ namespace AZ
|
||||
|
||||
// --- Utility functions ---
|
||||
|
||||
//! Queues the pass to have BuildAttachments() called by the PassSystem on frame update
|
||||
void QueueForBuildAttachments();
|
||||
//! Queues the pass to have Build() and Initilize() called by the PassSystem on frame update
|
||||
void QueueForBuildAndInitialization();
|
||||
|
||||
//! Queues the pass to have RemoveFromParent() called by the PassSystem on frame update
|
||||
void QueueForRemoval(bool needsDeletion = false);
|
||||
void QueueForRemoval();
|
||||
|
||||
//! Queues the pass to have Initialize() called by the PassSystem on frame update
|
||||
void QueueForInitialization();
|
||||
|
||||
//! Adds an attachment binding to the list of this Pass' attachment bindings
|
||||
void AddAttachmentBinding(PassAttachmentBinding attachmentBinding);
|
||||
@@ -173,8 +177,8 @@ namespace AZ
|
||||
|
||||
//! Attach an external buffer resource as attachment to specified slot
|
||||
//! The buffer will be added as a pass attachment then attach to the pass slot
|
||||
//! Note: the pass attachment and binding will be removed after the general BuildAttachments call.
|
||||
//! you can add this call in pass' BuildAttachmentsInternal so it will be added whenever attachments get rebuilt
|
||||
//! Note: the pass attachment and binding will be removed after the general Build call.
|
||||
//! you can add this call in pass' BuildInternal so it will be added whenever attachments get rebuilt
|
||||
void AttachBufferToSlot(AZStd::string_view slot, Data::Instance<Buffer> buffer);
|
||||
void AttachBufferToSlot(const Name& slot, Data::Instance<Buffer> buffer);
|
||||
void AttachImageToSlot(const Name& slot, Data::Instance<AttachmentImage> image);
|
||||
@@ -256,6 +260,12 @@ namespace AZ
|
||||
//! Returns pointer to the parent pass
|
||||
ParentPass* GetParent() const;
|
||||
|
||||
PassState GetPassState() const;
|
||||
|
||||
// Update all bindings on this pass that are connected to bindings on other passes
|
||||
void UpdateConnectedBindings();
|
||||
|
||||
|
||||
protected:
|
||||
explicit Pass(const PassDescriptor& descriptor);
|
||||
|
||||
@@ -309,18 +319,23 @@ namespace AZ
|
||||
// customize it's behavior, hence why these functions are called the pass behavior functions.
|
||||
|
||||
// Resets everything in the pass (like Attachments).
|
||||
// Called from PassSystem when pass is QueueForBuildAttachments.
|
||||
// Called from PassSystem when pass is QueueForBuildAndInitialization.
|
||||
void Reset();
|
||||
virtual void ResetInternal() { }
|
||||
|
||||
// Builds and sets up any attachments and input/output connections the pass needs.
|
||||
// Called from PassSystem when pass is QueueForBuildAttachments.
|
||||
void BuildAttachments();
|
||||
virtual void BuildAttachmentsInternal() { }
|
||||
// Called from PassSystem when pass is QueueForBuildAndInitialization.
|
||||
void Build(bool calledFromPassSystem = false);
|
||||
virtual void BuildInternal() { }
|
||||
|
||||
// Called after the pass build phase has finished. Allows passes to reset build flags.
|
||||
void OnBuildAttachmentsFinished();
|
||||
virtual void OnBuildAttachmentsFinishedInternal() { };
|
||||
// Allows for additional pass initialization between building and rendering
|
||||
// Can be queued independently of Build so as to only invoke Initialize() without Build()
|
||||
void Initialize();
|
||||
virtual void InitializeInternal() { };
|
||||
|
||||
// Called after the pass initialization phase has finished. Allows passes to reset various states and flags.
|
||||
void OnInitializationFinished();
|
||||
virtual void OnInitializationFinishedInternal() { };
|
||||
|
||||
// The Pass's 'Render' function. Called every frame, here the pass sets up it's rendering logic with
|
||||
// the FrameGraphBuilder. This is where your derived pass needs to call ImportScopeProducer on
|
||||
@@ -378,21 +393,36 @@ namespace AZ
|
||||
{
|
||||
struct
|
||||
{
|
||||
// Whether this pass was created with a PassRequest (in which case m_request holds valid data)
|
||||
uint64_t m_createdByPassRequest : 1;
|
||||
uint64_t m_initialized : 1;
|
||||
|
||||
// Whether the pass is enabled (behavior can be customized by overriding IsEnabled() )
|
||||
uint64_t m_enabled : 1;
|
||||
|
||||
// False if parent or one of it's ancestors is disabled
|
||||
uint64_t m_parentEnabled : 1;
|
||||
uint64_t m_alreadyCreated : 1;
|
||||
uint64_t m_alreadyReset : 1;
|
||||
uint64_t m_alreadyPrepared : 1;
|
||||
|
||||
// If this is a parent pass, indicates if the pass has already created children this frame
|
||||
// Prevents ParentPass::CreateChildPasses from executing multiple times in the same pass
|
||||
uint64_t m_alreadyCreatedChildren : 1;
|
||||
|
||||
// If this is a parent pass, indicates whether the pass needs to create child passes
|
||||
uint64_t m_createChildren : 1;
|
||||
|
||||
// Whether this pass belongs to the pass hierarchy, i.e. if you can trace it's parents up to the Root pass
|
||||
uint64_t m_partOfHierarchy : 1;
|
||||
|
||||
// Whether this pass has a DrawListTag
|
||||
uint64_t m_hasDrawListTag : 1;
|
||||
|
||||
// Whether this pass has a PipelineViewTag
|
||||
uint64_t m_hasPipelineViewTag : 1;
|
||||
uint64_t m_queuedForBuildAttachment : 1;
|
||||
|
||||
// Whether the pass should gather timestamp query metrics
|
||||
uint64_t m_timestampQueryEnabled : 1;
|
||||
|
||||
// Whether the pass should gather pipeline statics
|
||||
uint64_t m_pipelineStatisticsQueryEnabled : 1;
|
||||
uint64_t m_isBuildingAttachments : 1;
|
||||
uint64_t m_isRendering : 1;
|
||||
};
|
||||
uint64_t m_allFlags = 0;
|
||||
};
|
||||
@@ -412,6 +442,7 @@ namespace AZ
|
||||
// fully custom sort implementations by overriding the SortDrawList() function.
|
||||
RHI::DrawListSortType m_drawListSortType = RHI::DrawListSortType::KeyThenDepth;
|
||||
|
||||
|
||||
private:
|
||||
// Return the Timestamp result of this pass
|
||||
virtual TimestampResult GetTimestampResultInternal() const;
|
||||
@@ -423,6 +454,10 @@ namespace AZ
|
||||
// buffers and images don't get deleted during attachment build phase
|
||||
void StoreImportedAttachmentReferences();
|
||||
|
||||
// Used by the RenderPipeline to create it's passes immediately instead of waiting on
|
||||
// the next Pass System update. The function internally build and initializes the pass.
|
||||
void ManualPipelineBuildAndInitialize();
|
||||
|
||||
// --- Hierarchy related functions ---
|
||||
|
||||
// Called when the pass gets a new spot in the pass hierarchy
|
||||
@@ -460,9 +495,6 @@ namespace AZ
|
||||
// This sets the binding's attachment pointer to the connected binding's attachment
|
||||
void UpdateConnectedBinding(PassAttachmentBinding& binding);
|
||||
|
||||
// Update all bindings on this pass that are connected to bindings on other passes
|
||||
void UpdateConnectedBindings();
|
||||
|
||||
// Process a PassFallbackConnection to connect an output to an input to act as a short-circuit for when Pass is disabled
|
||||
void ProcessFallbackConnection(const PassFallbackConnection& connection);
|
||||
|
||||
@@ -502,6 +534,7 @@ namespace AZ
|
||||
// buffers and images don't get deleted during attachment build phase
|
||||
AZStd::vector<Ptr<PassAttachment>> m_importedAttachmentStore;
|
||||
|
||||
// Name of the pass. Will be concatenated with parent names to form a unique path
|
||||
Name m_name;
|
||||
|
||||
// Path of the pass in the hierarchy. Example: Root.Ssao.Downsample
|
||||
@@ -510,6 +543,12 @@ namespace AZ
|
||||
// Depth of the tree hierarchy this pass is at.
|
||||
// Example: Root would be depth 0, Root.Ssao.Downsample depth 2
|
||||
uint32_t m_treeDepth = 0;
|
||||
|
||||
// Used to track what phase of build/execution the pass is in
|
||||
PassState m_state = PassState::Uninitialized;
|
||||
|
||||
// Used to track what phases of build/initialization the pass is queued for
|
||||
PassQueueState m_queueState = PassQueueState::NoQueue;
|
||||
};
|
||||
|
||||
//! Struct used to return results from Pass hierarchy validation
|
||||
|
||||
@@ -21,3 +21,100 @@
|
||||
// Set this to 1 locally on your machine to facilitate pass debugging and get extra information
|
||||
// about passes in the output window. DO NOT SUBMIT with value set to 1
|
||||
#define AZ_RPI_ENABLE_PASS_DEBUGGING 0
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
namespace RPI
|
||||
{
|
||||
// This enum tracks the state of passes across build, initialization and rendering
|
||||
//
|
||||
// Standard order of state progression:
|
||||
//
|
||||
// Uninitialized -> Queued -> Resetting -> Reset -> Building -> Built -> Initializing -> Initialized -> Idle -> Rendering -> Idle ...
|
||||
//
|
||||
// Addition state transitions:
|
||||
//
|
||||
// Queued -> Resetting
|
||||
// -> Building
|
||||
// -> Initializing
|
||||
//
|
||||
// Idle -> Queued
|
||||
// -> Resetting
|
||||
// -> Building
|
||||
// -> Initializing
|
||||
// -> Rendering
|
||||
//
|
||||
// Rendering -> Idle
|
||||
// -> Queued (Rendering will transition to Queued if a pass was queued with the PassSystem during Rendering)
|
||||
//
|
||||
enum class PassState : u8
|
||||
{
|
||||
// Default value, you should only ever see this in the Pass constructor
|
||||
// Once the constructor is done, the Pass will set it's state to Reset
|
||||
Uninitialized,
|
||||
// |
|
||||
// |
|
||||
// V
|
||||
// Pass is queued with the Pass System for an update (see PassQueueState below)
|
||||
Queued,
|
||||
// |
|
||||
// |
|
||||
// V
|
||||
// Pass is currently in the process of resetting
|
||||
Resetting,
|
||||
// |
|
||||
// |
|
||||
// V
|
||||
// Pass has been reset and is awaiting build
|
||||
Reset,
|
||||
// |
|
||||
// |
|
||||
// V
|
||||
// Pass is currently building
|
||||
Building,
|
||||
// |
|
||||
// |
|
||||
// V
|
||||
// Pass has been built and is awaiting initialization
|
||||
Built,
|
||||
// |
|
||||
// |
|
||||
// V
|
||||
// Pass is currently being initialized
|
||||
Initializing,
|
||||
// |
|
||||
// |
|
||||
// V
|
||||
// Pass has been initialized
|
||||
Initialized,
|
||||
// |
|
||||
// |
|
||||
// V
|
||||
// Idle state, pass is awaiting rendering
|
||||
Idle,
|
||||
// |
|
||||
// |
|
||||
// V
|
||||
// Pass is currently rendering. Pass must be in Idle state before entering this state
|
||||
Rendering
|
||||
};
|
||||
|
||||
// This enum keeps track of what actions the pass is queued for with the pass system
|
||||
enum class PassQueueState : u8
|
||||
{
|
||||
// The pass is currently not in any queued state and may therefore transition to any queued state
|
||||
NoQueue,
|
||||
|
||||
// The pass is queued for Removal at the start of the next frame. Has the highest priority and cannot be overridden by any other queue state
|
||||
QueuedForRemoval,
|
||||
|
||||
// The pass is queued for Build at the start of the frame. Note that any pass built at the start of the frame will also be Initialized.
|
||||
// This state can be overridden by QueuedForRemoval, as we don't want to build a pass that has been removed.
|
||||
QueuedForBuildAndInitialization,
|
||||
|
||||
// The pass is queued for Initialization at the start of the frame.
|
||||
// This state has the lowest priority and can therefore be overridden by QueueForBuildAndInitialization or QueueForRemoval.
|
||||
QueuedForInitialization,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,12 +73,12 @@ namespace AZ
|
||||
bool LoadPassTemplateMappings(const AZStd::string& templateMappingPath) override;
|
||||
void WriteTemplateToFile(const PassTemplate& passTemplate, AZStd::string_view assetFilePath) override;
|
||||
void DebugPrintPassHierarchy() override;
|
||||
bool IsBuilding() const override;
|
||||
bool IsHotReloading() const override;
|
||||
void SetHotReloading(bool hotReloading) override;
|
||||
void SetTargetedPassDebuggingName(const AZ::Name& targetPassName) override;
|
||||
const AZ::Name& GetTargetedPassDebuggingName() const override;
|
||||
void ConnectEvent(OnReadyLoadTemplatesEvent::Handler& handler) override;
|
||||
PassSystemState GetState() const override;
|
||||
|
||||
// PassSystemInterface factory related functions...
|
||||
void AddPassCreator(Name className, PassCreator createFunction) override;
|
||||
@@ -103,8 +103,11 @@ namespace AZ
|
||||
// Returns the root of the pass tree hierarchy
|
||||
const Ptr<ParentPass>& GetRootPass() override;
|
||||
|
||||
// Calls BuildAttachments() on passes queued in m_buildAttachmentsList
|
||||
void BuildPassAttachments();
|
||||
// Calls Build() on passes queued in m_buildPassList
|
||||
void BuildPasses();
|
||||
|
||||
// Calls Initialize() on passes queued in m_initializePassList
|
||||
void InitializePasses();
|
||||
|
||||
// Validates Pass Hierarchy after building
|
||||
void Validate();
|
||||
@@ -113,13 +116,15 @@ namespace AZ
|
||||
void RemovePasses();
|
||||
|
||||
// Functions for queuing passes in the lists below
|
||||
void QueueForBuildAttachments(Pass* pass) override;
|
||||
void QueueForBuild(Pass* pass) override;
|
||||
void QueueForRemoval(Pass* pass) override;
|
||||
void QueueForInitialization(Pass* pass) override;
|
||||
|
||||
// Lists for queuing passes for various function calls
|
||||
// Name of the list reflects the pass function it will call
|
||||
AZStd::vector< Ptr<Pass> > m_buildAttachmentsList;
|
||||
AZStd::vector< Ptr<Pass> > m_buildPassList;
|
||||
AZStd::vector< Ptr<Pass> > m_removePassList;
|
||||
AZStd::vector< Ptr<Pass> > m_initializePassList;
|
||||
|
||||
// Library of pass descriptors that can be instantiated through data driven pass requests
|
||||
PassLibrary m_passLibrary;
|
||||
@@ -133,9 +138,6 @@ namespace AZ
|
||||
// Whether the Pass Hierarchy changed
|
||||
bool m_passHierarchyChanged = true;
|
||||
|
||||
// Whether the Pass System is currently in it's building phase
|
||||
bool m_isBuilding = false;
|
||||
|
||||
// Whether the Pass System is currently hot reloading passes
|
||||
bool m_isHotReloading = false;
|
||||
|
||||
@@ -147,6 +149,9 @@ namespace AZ
|
||||
|
||||
// Events
|
||||
OnReadyLoadTemplatesEvent m_loadTemplatesEvent;
|
||||
|
||||
// Used to track what phase of execution the pass system is in
|
||||
PassSystemState m_state = PassSystemState::Unitialized;
|
||||
};
|
||||
} // namespace RPI
|
||||
} // namespace AZ
|
||||
|
||||
@@ -40,6 +40,37 @@ namespace AZ
|
||||
|
||||
using PassCreator = AZStd::function<Ptr<Pass>(const PassDescriptor& descriptor)>;
|
||||
|
||||
// Enum to track the different execution phases of the Pass System
|
||||
enum class PassSystemState : u32
|
||||
{
|
||||
// Default state,
|
||||
Unitialized,
|
||||
|
||||
// Initial Pass System setup. Transitions to Idle
|
||||
InitializingPassSystem,
|
||||
|
||||
// Pass System is processing passes queued for Removal. Transitions to Idle
|
||||
RemovingPasses,
|
||||
|
||||
// Pass System is processing passes queued for Build (and their child passes). Transitions to Idle
|
||||
BuildingPasses,
|
||||
|
||||
// Pass System is processing passes queued for Initialization (and their child passes). Transitions to Idle
|
||||
InitializingPasses,
|
||||
|
||||
// Pass System is validating that the Pass hierarchy is in a valid state after Build and Initialization. Transitions to Idle
|
||||
ValidatingPasses,
|
||||
|
||||
// Pass System is idle and can transition to any other state (except FrameEnd)
|
||||
Idle,
|
||||
|
||||
// Pass System is currently rendering a frame. Transitions to FrameEnd
|
||||
Rendering,
|
||||
|
||||
// Pass System is finishing rendering a frame. Transitions to Idle
|
||||
FrameEnd,
|
||||
};
|
||||
|
||||
class PassSystemInterface
|
||||
{
|
||||
friend class Pass;
|
||||
@@ -77,9 +108,6 @@ namespace AZ
|
||||
//! Prints the entire pass hierarchy from the root
|
||||
virtual void DebugPrintPassHierarchy() = 0;
|
||||
|
||||
//! Returns whether the Pass System is currently in it's build phase
|
||||
virtual bool IsBuilding() const = 0;
|
||||
|
||||
//! Returns whether the Pass System is currently hot reloading
|
||||
virtual bool IsHotReloading() const = 0;
|
||||
|
||||
@@ -157,15 +185,20 @@ namespace AZ
|
||||
//! The handler can add new pass templates or load pass template mappings from assets
|
||||
virtual void ConnectEvent(OnReadyLoadTemplatesEvent::Handler& handler) = 0;
|
||||
|
||||
virtual PassSystemState GetState() const = 0;
|
||||
|
||||
private:
|
||||
// These functions are only meant to be used by the Pass class
|
||||
|
||||
// Schedules a pass to have it's BuildAttachments() function called during frame update
|
||||
virtual void QueueForBuildAttachments(Pass* pass) = 0;
|
||||
// Schedules a pass to have it's Build() function called during frame update
|
||||
virtual void QueueForBuild(Pass* pass) = 0;
|
||||
|
||||
// Schedules a pass to be deleted during frame update
|
||||
virtual void QueueForRemoval(Pass* pass) = 0;
|
||||
|
||||
// Schedules a pass to be initialized during frame update
|
||||
virtual void QueueForInitialization(Pass* pass) = 0;
|
||||
|
||||
//! Registers the pass with the pass library. Called in the Pass constructor.
|
||||
virtual void RegisterPass(Pass* pass) = 0;
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@ namespace AZ
|
||||
void BindPassSrg(const RHI::FrameGraphCompileContext& context, Data::Instance<ShaderResourceGroup>& shaderResourceGroup);
|
||||
|
||||
// Pass behavior overrides...
|
||||
void OnBuildAttachmentsFinishedInternal() override;
|
||||
void InitializeInternal() override;
|
||||
void FrameBeginInternal(FramePrepareParams params) override;
|
||||
void FrameEndInternal() override;
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace AZ
|
||||
// Pass Behaviour Overrides...
|
||||
|
||||
void ResetInternal() override;
|
||||
void BuildAttachmentsInternal() override;
|
||||
void BuildInternal() override;
|
||||
void FrameBeginInternal(FramePrepareParams params) override;
|
||||
|
||||
private:
|
||||
|
||||
@@ -61,7 +61,7 @@ namespace AZ
|
||||
|
||||
// Pass overrides
|
||||
void CreateChildPassesInternal() override;
|
||||
void BuildAttachmentsInternal() override;
|
||||
void BuildInternal() override;
|
||||
void FrameBeginInternal(FramePrepareParams params) override;
|
||||
void FrameEndInternal() override;
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user