#include <AliasedAttachmentAllocator.h>
Inherits AZ::RHI::DeviceObject, and FrameEventBus::Handler.
Classes | |
struct | Descriptor |
Public Member Functions | |
AZ_CLASS_ALLOCATOR (AliasedAttachmentAllocator< Heap >, AZ::SystemAllocator) | |
ResultCode | Init (Device &device, const Descriptor &descriptor) |
Initializes the allocator. | |
void | Begin (TransientAttachmentPoolCompileFlags compileFlags, const size_t memoryUsageHint=0) |
Buffer * | ActivateBuffer (const TransientBufferDescriptor &descriptor, Scope &scope) |
void | DeactivateBuffer (const AttachmentId &attachmentId, Scope &scope) |
Image * | ActivateImage (const TransientImageDescriptor &descriptor, Scope &scope) |
void | DeactivateImage (const AttachmentId &attachmentId, Scope &scope) |
void | End () |
Called when the allocations / deallocations have completed for all scopes. | |
void | Shutdown () override |
DeviceObject override. | |
void | GetStatistics (AZStd::vector< TransientAttachmentStatistics::Heap > &heapStatistics) const |
const Descriptor & | GetDescriptor () const |
Get allocator descriptor. | |
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. | |
Device & | GetDevice () 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 Ptr< AliasedAttachmentAllocator > | Create () |
Additional Inherited Members | |
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 inherited from AZ::RHI::Object | |
AZStd::atomic_int | m_useCount = 0 |
Utility class that Allocates Aliased Transient Attachments using one or multiple Heaps. The allocator uses pages, where each page corresponds to a Heap that is implemented by the platform. Users must provide a "Heap" class that inherits from the RHI::AliasedHeap class. This allocator use different allocation strategies described by the RHI::HeapAllocationStrategy enum. Depending on the strategy selected, the allocator can grow/shrink by allocating/deallocating heap pages. It can also compact a heap page if it is being underutilized. We also use the template type so we can inherit the AliasedAttachmentAllocator::Descriptor from the Heap::Descriptor to pass implementation specific parameters during the heap initialization.
Buffer * AZ::RHI::AliasedAttachmentAllocator< Heap >::ActivateBuffer | ( | const TransientBufferDescriptor & | descriptor, |
Scope & | scope | ||
) |
Called when a buffer is being activated for the first time. This will acquire a buffer from a heap, configured for the provided descriptor. This may trigger a new heap to be allocated.
Image * AZ::RHI::AliasedAttachmentAllocator< Heap >::ActivateImage | ( | const TransientImageDescriptor & | descriptor, |
Scope & | scope | ||
) |
Called when an image is being activated for the first time. This will acquire an image from a heap, configured for the provided descriptor. This may trigger a new heap to be allocated.
void AZ::RHI::AliasedAttachmentAllocator< Heap >::Begin | ( | TransientAttachmentPoolCompileFlags | compileFlags, |
const size_t | memoryUsageHint = 0 |
||
) |
This is called at the beginning of the compile phase for the current frame, before any allocations occur.
compileFlags | The flags that will be use during the resources activation. |
memoryUsageHint | [Optional] The total amount of memory needed by the allocator for allocating resources in the Begin/End cycle. This value is needed when the allocator is using a "MemoryHint" allocation strategy. The amount of memory needed can be calculated by doing a first pass with the flag TransientAttachmentPoolCompileFlags::DontAllocateResources. |
void AZ::RHI::AliasedAttachmentAllocator< Heap >::DeactivateBuffer | ( | const AttachmentId & | attachmentId, |
Scope & | scope | ||
) |
Called when a buffer is being de-allocated from the allocator. Called during the last scope the attachment is used, after all allocations for that scope have been processed.
void AZ::RHI::AliasedAttachmentAllocator< Heap >::DeactivateImage | ( | const AttachmentId & | attachmentId, |
Scope & | scope | ||
) |
Called when a image is being de-allocated from the allocator. Called during the last scope the attachment is used, after all allocations for that scope have been processed.
void AZ::RHI::AliasedAttachmentAllocator< Heap >::GetStatistics | ( | AZStd::vector< TransientAttachmentStatistics::Heap > & | heapStatistics | ) | const |
Get statistics for the pool (built during End). Statistics will be added at the end of the provided vector.
|
overridevirtual |
DeviceObject override.
Reimplemented from AZ::RHI::Object.