Open 3D Engine Atom Gem API Reference  2205.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
AZ::RPI::RenderToTexturePass Class Referencefinal

#include <RenderToTexturePass.h>

Inherits AZ::RPI::ParentPass.

Public Member Functions

 AZ_RTTI (RenderToTexturePass, "{4FBA3461-A072-4538-84D1-311D2756B27E}", ParentPass)
 
 AZ_CLASS_ALLOCATOR (RenderToTexturePass, SystemAllocator, 0)
 
 RenderToTexturePass (const PassDescriptor &descriptor)
 
Ptr< ParentPassRecreate () const override
 
void ReadbackOutput (AZStd::shared_ptr< AttachmentReadback > readback)
 
void ResizeOutput (uint32_t width, uint32_t height)
 
- Public Member Functions inherited from AZ::RPI::ParentPass
 AZ_RTTI (ParentPass, "{0801AD74-85A8-4895-A5E5-C500AEE535A6}", Pass)
 
 AZ_CLASS_ALLOCATOR (ParentPass, SystemAllocator, 0)
 
void GetPipelineViewTags (SortedPipelineViewTags &outTags) const override
 Recursively collects all different view tags from this pass's children.
 
void GetViewDrawListInfo (RHI::DrawListMask &outDrawListMask, PassesByDrawList &outPassesByDrawList, const PipelineViewTag &viewTag) const override
 Recursively searches children for given viewTag, and collects their DrawListTags in outDrawListMask.
 
void SetRenderPipeline (RenderPipeline *pipeline) override
 Set render pipeline this pass belongs to recursively.
 
Ptr< PassAttachmentGetOwnedAttachment (const Name &attachmentName) const
 Return owning attachment.
 
void AddChild (const Ptr< Pass > &child)
 Adds pass to list of children.
 
bool InsertChild (const Ptr< Pass > &child, ChildPassIndex position)
 
bool InsertChild (const Ptr< Pass > &child, uint32_t index)
 
void OnChildAdded (const Ptr< Pass > &child)
 Called when a pass is added as a child pass to this parent.
 
ChildPassIndex FindChildPassIndex (const Name &passName) const
 Searches for a child pass with the given name. Returns the child's index if found, null index otherwise.
 
Ptr< PassFindChildPass (const Name &passName) const
 Find a child pass with a matching name and returns it. Return nullptr if none found.
 
template<typename PassType >
Ptr< PassType > FindChildPass () const
 
AZStd::span< const Ptr< Pass > > GetChildren () const
 Gets the list of children. Useful for validating hierarchies.
 
const PassFindPass (RHI::DrawListTag drawListTag) const
 Searches the tree for the first pass that uses the given DrawListTag.
 
void SetTimestampQueryEnabled (bool enable) override
 Recursively set all the Timestamp queries enabled for all its children.
 
void SetPipelineStatisticsQueryEnabled (bool enable) override
 Recursively set all the PipelineStatistics queries enabled for all its children.
 
void Validate (PassValidationResults &validationResults) override
 
void DebugPrint () const override
 Prints the pass and all of it's children.
 
- Public Member Functions inherited from AZ::RPI::Pass
 AZ_RTTI (Pass, "{EA34FF66-631D-433B-B449-71F5647E7BB5}", AZStd::intrusive_base)
 
 AZ_CLASS_ALLOCATOR (Pass, SystemAllocator, 0)
 
const Name & GetName () const
 Returns the name of the pass (example: Bloom)
 
const Name & GetPathName () const
 Return the path name of the pass (example: Root.SwapChain.Bloom)
 
uint32_t GetTreeDepth () const
 Returns the depth of this pass in the tree hierarchy (Root depth is 0)
 
uint32_t GetParentChildIndex () const
 Returns the index in the parent's array of children that this pass occupies (used for sorting passes)
 
uint32_t GetInputCount () const
 Returns the number of input attachment bindings.
 
uint32_t GetInputOutputCount () const
 Returns the number of input/output attachment bindings.
 
uint32_t GetOutputCount () const
 Returns the number of output attachment bindings.
 
const PassTemplateGetPassTemplate () const
 
void SetEnabled (bool enabled)
 
virtual bool IsEnabled () const
 
bool HasDrawListTag () const
 
bool HasPipelineViewTag () const
 
PassAttachmentBindingListView GetAttachmentBindings () const
 Return the set of attachment bindings.
 
ParentPassAsParent ()
 Casts the pass to a parent pass if valid, else returns nullptr.
 
const ParentPassAsParent () const
 
void QueueForBuildAndInitialization ()
 Queues the pass to have Build() and Initialize() called by the PassSystem on frame update.
 
void QueueForRemoval ()
 Queues the pass to have RemoveFromParent() called by the PassSystem on frame update.
 
void QueueForInitialization ()
 Queues the pass to have Initialize() called by the PassSystem on frame update.
 
void AddAttachmentBinding (PassAttachmentBinding attachmentBinding)
 Adds an attachment binding to the list of this Pass' attachment bindings.
 
PassAttachmentBindingGetInputBinding (uint32_t index)
 
PassAttachmentBindingGetInputOutputBinding (uint32_t index)
 
PassAttachmentBindingGetOutputBinding (uint32_t index)
 
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)
 
virtual RHI::DrawListTag GetDrawListTag () const
 Check if the pass has a DrawListTag. Pass' DrawListTag can be used to filter draw items.
 
virtual void SortDrawList (RHI::DrawList &drawList) const
 Function used by views to sort draw lists. Can be overridden so passes can provide custom sort functionality.
 
virtual const PipelineViewTag & GetPipelineViewTag () const
 Check if the pass is associated to a view. If pass has a pipeline view tag, the rpi view assigned to this view tag will have pass's draw list tag.
 
RenderPipelineGetRenderPipeline () const
 
SceneGetScene () const
 
TimestampResult GetLatestTimestampResult () const
 Return the latest Timestamp result of this pass.
 
PipelineStatisticsResult GetLatestPipelineStatisticsResult () const
 Return the latest PipelineStatistic result of this pass.
 
bool ReadbackAttachment (AZStd::shared_ptr< AttachmentReadback > readback, const Name &slotName, PassAttachmentReadbackOption option=PassAttachmentReadbackOption::Output)
 
bool IsTimestampQueryEnabled () const
 Returns whether the Timestamp queries is enabled/disabled for this pass.
 
bool IsPipelineStatisticsQueryEnabled () const
 Returns whether the PipelineStatistics queries is enabled/disabled for this pass.
 
void PrintIndent (AZStd::string &stringOutput, uint32_t indent) const
 Helper function to print spaces to indent the pass.
 
void PrintPassName (AZStd::string &stringOutput, uint32_t indent=0) const
 Prints the name of the pass.
 
void DebugPrintBinding (AZStd::string &stringOutput, const PassAttachmentBinding &binding) const
 Prints the attachment binding at the given index.
 
void DebugPrintBindingAndConnection (AZStd::string &stringOutput, uint8_t bindingIndex) const
 Prints the attachment binding at the given index and its connection.
 
void PrintErrors () const
 Prints the pass name and all the errors accumulated during build and setup.
 
void PrintWarnings () const
 Prints the pass name and all the warnings accumulated during build and setup.
 
void PrintMessages (const AZStd::vector< AZStd::string > &messages) const
 Helper function to print an array of messages (like errors or warnings) for a pass.
 
void PrintBindingsWithoutAttachments (uint32_t slotTypeMask) const
 Prints the pass and all the list of inputs and input/outputs that are missing an attachment.
 
ParentPassGetParent () const
 Returns pointer to the parent pass.
 
PassState GetPassState () const
 
void UpdateConnectedBindings ()
 
void UpdateConnectedInputBindings ()
 
void UpdateConnectedOutputBindings ()
 

Static Public Member Functions

static Ptr< RenderToTexturePassCreate (const PassDescriptor &descriptor)
 
- Static Public Member Functions inherited from AZ::RPI::ParentPass
static Ptr< ParentPassCreate (const PassDescriptor &descriptor)
 Creates a new pass without a PassTemplate.
 

Protected Member Functions

void OnUpdateOutputSize ()
 
- Protected Member Functions inherited from AZ::RPI::ParentPass
 ParentPass (const PassDescriptor &descriptor)
 
void CreateChildPasses ()
 
void RemoveChild (Ptr< Pass > pass)
 
void RemoveChildren ()
 
- Protected Member Functions inherited from AZ::RPI::Pass
 Pass (const PassDescriptor &descriptor)
 
PassDescriptor GetPassDescriptor () const
 
void ImportAttachments (RHI::FrameGraphAttachmentInterface attachmentDatabase)
 
Ptr< PassFindAdjacentPass (const Name &passName)
 
PassAttachmentBindingFindAttachmentBinding (const Name &slotName)
 
const PassAttachmentBindingFindAttachmentBinding (const Name &slotName) const
 
Ptr< PassAttachmentFindOwnedAttachment (const Name &attachmentName) const
 
Ptr< PassAttachmentFindAttachment (const Name &slotName) const
 
const PassAttachmentBindingFindAdjacentBinding (const PassAttachmentRef &attachmentRef)
 
void ProcessConnection (const PassConnection &connection, uint32_t slotTypeMask=0xFFFFFFFF)
 
void LogError (AZStd::string &&message)
 
void LogWarning (AZStd::string &&message)
 
void Reset ()
 
void Build (bool calledFromPassSystem=false)
 
void Initialize ()
 
void OnInitializationFinished ()
 
void FrameBegin (FramePrepareParams params)
 
void FrameEnd ()
 
void UpdateReadbackAttachment (FramePrepareParams params, bool beforeAddScopes)
 
void UpdateAttachmentCopy (FramePrepareParams params)
 

Additional Inherited Members

- Public Types inherited from AZ::RPI::ParentPass
using ChildPassIndex = RHI::Handle< uint32_t, class ChildPass >
 
- Public Types inherited from AZ::RPI::Pass
using ChildPassIndex = RHI::Handle< uint32_t, class ChildPass >
 
- Protected Attributes inherited from AZ::RPI::ParentPass
AZStd::vector< Ptr< Pass > > m_children
 
- Protected Attributes inherited from AZ::RPI::Pass
const Name PassNameThis {"This"}
 
const Name PassNameParent {"Parent"}
 
const Name PipelineKeyword {"Pipeline"}
 
const Name PipelineGlobalKeyword {"PipelineGlobal"}
 
AZStd::fixed_vector< PassAttachmentBinding, PassAttachmentBindingCountMax > m_attachmentBindings
 
AZStd::vector< Ptr< PassAttachment > > m_ownedAttachments
 
AZStd::vector< Pass * > m_executeBeforePasses
 
AZStd::vector< Pass * > m_executeAfterPasses
 
RenderPipelinem_pipeline = nullptr
 
AZStd::shared_ptr< const PassTemplatem_template = nullptr
 
PassRequest m_request
 
ParentPassm_parent = nullptr
 
struct {
   union {
      struct {
         uint64_t   m_createdByPassRequest: 1
 
         uint64_t   m_enabled: 1
 
         uint64_t   m_parentEnabled: 1
 
         uint64_t   m_alreadyCreatedChildren: 1
 
         uint64_t   m_createChildren: 1
 
         uint64_t   m_partOfHierarchy: 1
 
         uint64_t   m_hasDrawListTag: 1
 
         uint64_t   m_hasPipelineViewTag: 1
 
         uint64_t   m_timestampQueryEnabled: 1
 
         uint64_t   m_pipelineStatisticsQueryEnabled: 1
 
         uint64_t   m_isPipelineRoot: 1
 
         uint64_t   m_containsGlobalReference: 1
 
      } 
 
      uint64_t   m_allFlags = 0
 
   } 
 
m_flags
 
AZStd::vector< AZStd::string > m_errorMessages
 
AZStd::vector< AZStd::string > m_warningMessages
 
uint32_t m_errors = 0
 
uint32_t m_warnings = 0
 
RHI::DrawListSortType m_drawListSortType = RHI::DrawListSortType::KeyThenDepth
 
AZStd::shared_ptr< AttachmentReadbackm_attachmentReadback
 
PassAttachmentReadbackOption m_readbackOption
 
AZStd::weak_ptr< ImageAttachmentCopym_attachmentCopy
 
AZStd::shared_ptr< PassDatam_passData = nullptr
 Optional data used during pass initialization.
 
- Static Protected Attributes inherited from AZ::RPI::Pass
static const size_t MessageLogLimit = 256
 

Detailed Description

RenderToTexturePass creates a render target and a child pass tree then have the child pass tree render to this render target. The RenderToTexturePass's pass descriptor defines the render target's size and format and the child pass's template name. RenderToTexturePass can also read back the render target. This is useful to render a render pipeline to a render target and (optional) read back its data to cpu memory for later use.

Member Function Documentation

◆ Recreate()

Ptr<ParentPass> AZ::RPI::RenderToTexturePass::Recreate ( ) const
overridevirtual

Creates a new parent pass reusing the same parameters used to create this pass This is used in scenarios like hot reloading where some of the templates in the pass library might have changed.

Reimplemented from AZ::RPI::ParentPass.


The documentation for this class was generated from the following file: