#include <TransientAttachmentPool.h>
Inherits AZ::RHI::MultiDeviceObject.
Public Member Functions | |
| AZ_CLASS_ALLOCATOR (TransientAttachmentPool, AZ::SystemAllocator, 0) | |
| AZ_RTTI (TransientAttachmentPool, "{7CCD1108-B233-4D37-8A80-65CBB1988B22}") | |
| AZ_RHI_MULTI_DEVICE_OBJECT_GETTER (TransientAttachmentPool) | |
| ResultCode | Init (MultiDevice::DeviceMask deviceMask, const AZStd::unordered_map< int, TransientAttachmentPoolDescriptor > &descriptors) |
| Called to initialize the pool. | |
| void | Shutdown () |
| Called to shutdown the pool. | |
| void | Begin (const TransientAttachmentPoolCompileFlags flags=TransientAttachmentPoolCompileFlags::None) |
| void | BeginScope (Scope &scopeBase) |
| Called when a new scope is being allocated. Scopes are allocated in submission order. | |
| Image * | ActivateImage (const TransientImageDescriptor &descriptor) |
| Buffer * | ActivateBuffer (const TransientBufferDescriptor &descriptor) |
| void | DeactivateBuffer (const AttachmentId &attachmentId) |
| void | DeactivateImage (const AttachmentId &attachmentId) |
| void | RemoveDeviceBuffer (int deviceIndex, Buffer *buffer) |
| Called when a buffer is not used on a specific device this frame. | |
| void | RemoveDeviceImage (int deviceIndex, Image *image) |
| Called when an image is not used on a specific device this frame. | |
| void | EndScope () |
| Called when all allocations for the current scope have completed. | |
| void | End () |
| Called when the allocations / deallocations have completed for all scopes. | |
| AZStd::unordered_map< int, TransientAttachmentStatistics > | GetStatistics () const |
| Get statistics for the pool (built during End). | |
| const AZStd::unordered_map< int, TransientAttachmentPoolDescriptor > & | GetDescriptor () 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::MultiDeviceObject | |
| AZ_RTTI (MultiDeviceObject, "{17D34F71-944C-4AF5-9823-627474C4C0A6}", Object) | |
| bool | IsInitialized () const |
| Returns whether the device object is initialized. | |
| AZ_FORCE_INLINE bool | IsDeviceSet (int deviceIndex) const |
| MultiDevice::DeviceMask | GetDeviceMask () 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. | |
Additional Inherited Members | |
Static Public Member Functions inherited from AZ::RHI::MultiDeviceObject | |
| template<typename T > | |
| static AZ_FORCE_INLINE void | IterateDevices (MultiDevice::DeviceMask deviceMask, T callback) |
Protected Member Functions inherited from AZ::RHI::MultiDeviceObject | |
| void | Init (MultiDevice::DeviceMask deviceMask) |
| The derived class should call this method to assign the device. | |
| template<typename T > | |
| AZ_FORCE_INLINE void | IterateDevices (T callback) |
| Helper method that will iterate over all selected devices and call the provided callback. | |
| template<typename T , typename U > | |
| AZ_FORCE_INLINE decltype(auto) | IterateObjects (U callback) |
| template<typename T , typename U > | |
| AZ_FORCE_INLINE decltype(auto) | IterateObjects (U callback) const |
| template<typename T > | |
| AZ_FORCE_INLINE Ptr< T > | GetDeviceObject (int deviceIndex) const |
Protected Member Functions inherited from AZ::RHI::Object | |
| void | add_ref () const |
| void | release () const |
Protected Attributes inherited from AZ::RHI::MultiDeviceObject | |
| AZStd::unordered_map< int, Ptr< DeviceObject > > | m_deviceObjects |
| A map of all device-specific objects, indexed by the device index. | |
Protected Attributes inherited from AZ::RHI::Object | |
| AZStd::atomic_int | m_useCount = 0 |
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.
| Buffer * AZ::RHI::TransientAttachmentPool::ActivateBuffer | ( | const TransientBufferDescriptor & | descriptor | ) |
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. Buffers are held in an internal cache.
| Image * AZ::RHI::TransientAttachmentPool::ActivateImage | ( | const TransientImageDescriptor & | descriptor | ) |
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. Images are held in an internal cache.
| void AZ::RHI::TransientAttachmentPool::Begin | ( | const TransientAttachmentPoolCompileFlags | flags = TransientAttachmentPoolCompileFlags::None | ) |
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.
| void AZ::RHI::TransientAttachmentPool::DeactivateBuffer | ( | const AttachmentId & | attachmentId | ) |
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. It will also be removed from the cache.
| void AZ::RHI::TransientAttachmentPool::DeactivateImage | ( | const AttachmentId & | attachmentId | ) |
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. It will also be removed from the cache.
|
virtual |
Called to shutdown the pool.
Reimplemented from AZ::RHI::MultiDeviceObject.