Open 3D Engine Atom Gem API Reference 23.10.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
AZ::RHI::TransientAttachmentPool Class Referenceabstract

#include <TransientAttachmentPool.h>

Inherits AZ::RHI::DeviceObject.

Inherited by AZ::DX12::TransientAttachmentPool, AZ::Metal::TransientAttachmentPool, AZ::Null::TransientAttachmentPool, and AZ::Vulkan::TransientAttachmentPool.

Public Member Functions

 AZ_RTTI (TransientAttachmentPool, "{D4A544E9-AE4A-4BD7-9E03-646DA8D86388}")
 
ResultCode Init (Device &device, const TransientAttachmentPoolDescriptor &descriptor)
 Called to initialize the pool.
 
void Shutdown ()
 Called to shutdown the pool.
 
void Begin (const TransientAttachmentPoolCompileFlags flags=TransientAttachmentPoolCompileFlags::None, const TransientAttachmentStatistics::MemoryUsage *memoryHint=nullptr)
 
void BeginScope (Scope &scopeBase)
 Called when a new scope is being allocated. Scopes are allocated in submission order.
 
virtual ImageActivateImage (const TransientImageDescriptor &descriptor)=0
 
virtual BufferActivateBuffer (const TransientBufferDescriptor &descriptor)=0
 
virtual void DeactivateBuffer (const AttachmentId &attachmentId)=0
 
virtual void DeactivateImage (const AttachmentId &attachmentId)=0
 
void EndScope ()
 Called when all allocations for the current scope have completed.
 
void End ()
 Called when the allocations / deallocations have completed for all scopes.
 
const TransientAttachmentStatisticsGetStatistics () const
 Get statistics for the pool (built during End).
 
const TransientAttachmentPoolDescriptorGetDescriptor () const
 Get pool descriptor.
 
TransientAttachmentPoolCompileFlags GetCompileFlags () const
 Get the compile flags being used during the allocation of resources.
 
- Public Member Functions inherited from AZ::RHI::DeviceObject
 AZ_RTTI (DeviceObject, "{17D34F71-944C-4AF5-9823-627474C4C0A6}", Object)
 
bool IsInitialized () const
 Returns whether the device object is initialized.
 
DeviceGetDevice () const
 
- Public Member Functions inherited from AZ::RHI::Object
 AZ_RTTI (Object, "{E43378F1-2331-4173-94B8-990ED20E6003}")
 
void SetName (const Name &name)
 Sets the name of the object.
 
const Name & GetName () const
 Returns the name set on the object by SetName.
 
uint32_t use_count ()
 Returns the current use count of the object.
 

Static Public Member Functions

static bool NeedsTransientAttachmentPool (const TransientAttachmentPoolDescriptor &descriptor)
 Returns true if a Transient Attachment Pool is needed according to the supplied descriptor.
 

Protected Member Functions

void CollectHeapStats (AliasedResourceTypeFlags typeMask, AZStd::span< const TransientAttachmentStatistics::Heap > heapStats)
 
- Protected Member Functions inherited from AZ::RHI::DeviceObject
void Init (Device &device)
 The derived class should call this method to assign the device.
 
void Shutdown () override
 Clears the current bound device to null.
 
- Protected Member Functions inherited from AZ::RHI::Object
void add_ref () const
 
void release () const
 

Protected Attributes

Scopem_currentScope = nullptr
 
RHI::TransientAttachmentStatistics m_statistics
 
- Protected Attributes inherited from AZ::RHI::Object
AZStd::atomic_int m_useCount = 0
 

Detailed Description

The transient attachment pool interface is used by the frame scheduler to compile the working set of transient attachments for the frame. Each scope is iterated topologically and transient resources are allocated and de-allocated. This is all done from within the compile phase. Therefore, an allocation may create a resource, but a de-allocation does not destroy resources! All de-allocation does is inform the pool that a resource can be re-used within a subsequent scope. The final result of this process is a set of image / buffer attachments that are backed by guaranteed memory valid only for the scope in which they attached.

Member Function Documentation

◆ ActivateBuffer()

virtual Buffer * AZ::RHI::TransientAttachmentPool::ActivateBuffer ( const TransientBufferDescriptor descriptor)
pure virtual

Called when an buffer is being activated for the first time. This class should acquire an buffer from the pool, configured for the provided descriptor. This may involve aliasing from a heap, or simple object pooling.

◆ ActivateImage()

virtual Image * AZ::RHI::TransientAttachmentPool::ActivateImage ( const TransientImageDescriptor descriptor)
pure virtual

Called when an image is being activated for the first time. This class should acquire an image from the pool, configured for the provided descriptor. This may involve aliasing from a heap, or simple object pooling.

◆ Begin()

void AZ::RHI::TransientAttachmentPool::Begin ( const TransientAttachmentPoolCompileFlags  flags = TransientAttachmentPoolCompileFlags::None,
const TransientAttachmentStatistics::MemoryUsage memoryHint = nullptr 
)

This is called at the beginning of the compile phase for the current frame, before any allocations occur. The user should clear the backing allocator to a fresh state.

◆ DeactivateBuffer()

virtual void AZ::RHI::TransientAttachmentPool::DeactivateBuffer ( const AttachmentId &  attachmentId)
pure virtual

Called when a buffer is being de-allocated from the pool. Called during the last scope the attachment is used, after all allocations for that scope have been processed.

◆ DeactivateImage()

virtual void AZ::RHI::TransientAttachmentPool::DeactivateImage ( const AttachmentId &  attachmentId)
pure virtual

Called when a image is being de-allocated from the pool. Called during the last scope the attachment is used, after all allocations for that scope have been processed.

◆ Shutdown()

void AZ::RHI::TransientAttachmentPool::Shutdown ( )
virtual

Called to shutdown the pool.

Reimplemented from AZ::RHI::DeviceObject.


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