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::FreeListAllocator Class Referencefinal

Inherits AZ::RHI::Allocator.

Classes

struct  Descriptor
 

Public Member Functions

 AZ_CLASS_ALLOCATOR (FreeListAllocator, AZ::SystemAllocator)
 
void Init (const Descriptor &descriptor)
 
void Shutdown () override
 
VirtualAddress Allocate (size_t byteCount, size_t byteAlignment) override
 
void DeAllocate (VirtualAddress allocation) override
 
void GarbageCollect () override
 
void GarbageCollectForce () override
 Forces garbage collection of all allocations, regardless of the GC latency.
 
size_t GetAllocationCount () const override
 
size_t GetAllocatedByteCount () const override
 
const DescriptorGetDescriptor () const override
 Returns the descriptor used to initialize the allocator.
 
float ComputeFragmentation () const override
 
void Clone (RHI::Allocator *newAllocator) override
 Clone the current allocator to the new allocator passed in.
 
- Public Member Functions inherited from AZ::RHI::Allocator
virtual void Shutdown ()=0
 
virtual VirtualAddress Allocate (size_t byteCount, size_t byteAlignment)=0
 
virtual void DeAllocate (VirtualAddress offset)=0
 
virtual void GarbageCollect ()=0
 
virtual void GarbageCollectForce ()=0
 Forces garbage collection of all allocations, regardless of the GC latency.
 
virtual size_t GetAllocationCount () const
 
virtual size_t GetAllocatedByteCount () const
 
virtual const DescriptorGetDescriptor () const =0
 Returns the descriptor used to initialize the allocator.
 
virtual float ComputeFragmentation () const
 
virtual void Clone (RHI::Allocator *newAllocator)
 Clone the current allocator to the new allocator passed in.
 
template<typename T >
T * AllocateAs (size_t byteCount, size_t byteAlignment)
 

Member Function Documentation

◆ Allocate()

VirtualAddress AZ::RHI::FreeListAllocator::Allocate ( size_t  byteCount,
size_t  byteAlignment 
)
overridevirtual

Allocates a virtual address relative to the base address provided at initialization time.

Parameters
byteCountThe number of bytes to allocate.
byteAlignementThe alignment used to align the allocation.

Implements AZ::RHI::Allocator.

◆ Clone()

void AZ::RHI::FreeListAllocator::Clone ( RHI::Allocator newAllocator)
overridevirtual

Clone the current allocator to the new allocator passed in.

Reimplemented from AZ::RHI::Allocator.

◆ ComputeFragmentation()

float AZ::RHI::FreeListAllocator::ComputeFragmentation ( ) const
overridevirtual

Compute the fragmentation present in the allocator (possibly an estimate). The returned value is expected to be a measure between 0.f and 1.f inclusive, with 0.f indicating zero fragmentation.

Reimplemented from AZ::RHI::Allocator.

◆ DeAllocate()

void AZ::RHI::FreeListAllocator::DeAllocate ( VirtualAddress  offset)
overridevirtual

Deallocates an allocation. The memory is not reclaimed until garbage collect is called. Depending on the garbage collection latency, it may take several garbage collection cycles before the memory is reclaimed.

Implements AZ::RHI::Allocator.

◆ GarbageCollect()

void AZ::RHI::FreeListAllocator::GarbageCollect ( )
overridevirtual

Allocations are deferred-released until a specific number of GC cycles have occurred. This is useful for allocations actively being consumed by the GPU.

Implements AZ::RHI::Allocator.

◆ GarbageCollectForce()

void AZ::RHI::FreeListAllocator::GarbageCollectForce ( )
overridevirtual

Forces garbage collection of all allocations, regardless of the GC latency.

Implements AZ::RHI::Allocator.

◆ GetAllocatedByteCount()

size_t AZ::RHI::FreeListAllocator::GetAllocatedByteCount ( ) const
overridevirtual

Returns the number of bytes used by the allocator. This includes allocations that are pending garbage collection.

Reimplemented from AZ::RHI::Allocator.

◆ GetAllocationCount()

size_t AZ::RHI::FreeListAllocator::GetAllocationCount ( ) const
overridevirtual

Returns the number of allocations active for this allocator. This includes allocations that are pending garbage collection.

Reimplemented from AZ::RHI::Allocator.

◆ GetDescriptor()

const Descriptor & AZ::RHI::FreeListAllocator::GetDescriptor ( ) const
overridevirtual

Returns the descriptor used to initialize the allocator.

Implements AZ::RHI::Allocator.

◆ Shutdown()

void AZ::RHI::FreeListAllocator::Shutdown ( )
overridevirtual

Implements AZ::RHI::Allocator.


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