Pass changes: Addressing PR feedback

This commit is contained in:
antonmic
2021-06-10 12:50:38 -07:00
parent 886931f2a9
commit 2a982fa4b2
14 changed files with 109 additions and 59 deletions
@@ -81,7 +81,7 @@ namespace AZ
//! ending with 'Internal' to define the behavior of your passes. These virtual are recursively
//! 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 QueueForBuild, QueueForRemoval and QueueForInitialization.
//! 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,
@@ -154,8 +154,8 @@ namespace AZ
// --- Utility functions ---
//! Queues the pass to have Build() called by the PassSystem on frame update
void QueueForBuild();
//! 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();
@@ -319,12 +319,12 @@ 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 QueueForBuild.
// 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 QueueForBuild.
// Called from PassSystem when pass is QueueForBuildAndInitialization.
void Build(bool calledFromPassSystem = false);
virtual void BuildInternal() { }
@@ -403,7 +403,8 @@ namespace AZ
uint64_t m_parentEnabled : 1;
// If this is a parent pass, indicates if the pass has already created children this frame
uint64_t m_alreadyCreated : 1;
// 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;
@@ -453,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
@@ -27,46 +27,75 @@ 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)
// From Queued, the pass can transition into Resetting, Building or Initializing depending on the PassQueueState
Queued,
// |
// |
// V
// Pass is currently in the process of resetting
// From Resetting, the pass can transition into
Resetting,
// Pass has been reset and is await build
// From Reset, the pass can transition to Building
// |
// |
// V
// Pass has been reset and is awaiting build
Reset,
// |
// |
// V
// Pass is currently building
// From Building, the pass can transition to Built
Building,
// |
// |
// V
// Pass has been built and is awaiting initialization
// From Built, the pass can transition to Initializing
Built,
// |
// |
// V
// Pass is currently being initialized
// From Initializing, the pass can transition to Initialized
Initializing,
// |
// |
// V
// Pass has been initialized
// From Initialized, the pass can transition to Idle
Initialized,
// |
// |
// V
// Idle state, pass is awaiting rendering
// From Idle, the pass can transition to Queued, Resetting, Building, Initializing or Rendering
Idle,
// |
// |
// V
// Pass is currently rendering. Pass must be in Idle state before entering this state
// From Rendering, the pass can transition to Idle or Queue if the pass was queued with the Pass System during Rendering
Rendering
};
@@ -76,15 +105,15 @@ namespace AZ
// 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. Cannot be overridden by any other queue state
// 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
QueuedForBuild,
// 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 QueueForBuild or QueueForRemoval
// This state has the lowest priority and can therefore be overridden by QueueForBuildAndInitialization or QueueForRemoval.
QueuedForInitialization,
};
}