Foundation
Loading...
Searching...
No Matches
Public Member Functions | Static Public Attributes | List of all members
Foundation::RHI::RHIVirtualAllocator Class Referenceabstract

Sub-allocates byte ranges within an abstract fixed-size space. More...

#include <Resource.hpp>

Inheritance diagram for Foundation::RHI::RHIVirtualAllocator:
Foundation::RHI::RHIObject Foundation::RHI::VulkanVirtualAllocator

Public Member Functions

virtual uint64_t Allocate (uint64_t size, uint64_t alignment)=0
 Sub-allocates size bytes with the given alignment.
 
virtual void Free (uint64_t offset)=0
 
virtual void Clear ()=0
 
virtual uint64_t GetUsedBytes () const =0
 
virtual uint64_t GetCapacity () const =0
 
virtual uint64_t GetPeakUsage () const =0
 
- Public Member Functions inherited from Foundation::RHI::RHIObject
 RHIObject ()=default
 
 RHIObject (RHIObject const &)=delete
 
RHIObjectoperator= (const RHIObject &)=delete
 
 RHIObject (RHIObject &&)=delete
 
RHIObjectoperator= (RHIObject &&)=delete
 
virtual ~RHIObject ()=default
 

Static Public Attributes

static constexpr uint64_t kInvalidOffset = ~0ull
 

Detailed Description

Sub-allocates byte ranges within an abstract fixed-size space.

Backs offset-based suballocation of a single GPU buffer (e.g. GPUScene geometry): freed ranges are reused, live ranges never move. Implementation-defined, backed by the platform memory allocator (VMA virtual blocks on Vulkan).

Member Function Documentation

◆ Allocate()

virtual uint64_t Foundation::RHI::RHIVirtualAllocator::Allocate ( uint64_t  size,
uint64_t  alignment 
)
pure virtual

Sub-allocates size bytes with the given alignment.

Returns
The byte offset, or kInvalidOffset when the space is exhausted.

Implemented in Foundation::RHI::VulkanVirtualAllocator.

◆ Clear()

virtual void Foundation::RHI::RHIVirtualAllocator::Clear ( )
pure virtual

◆ Free()

virtual void Foundation::RHI::RHIVirtualAllocator::Free ( uint64_t  offset)
pure virtual

◆ GetCapacity()

virtual uint64_t Foundation::RHI::RHIVirtualAllocator::GetCapacity ( ) const
pure virtual

◆ GetPeakUsage()

virtual uint64_t Foundation::RHI::RHIVirtualAllocator::GetPeakUsage ( ) const
pure virtual

◆ GetUsedBytes()

virtual uint64_t Foundation::RHI::RHIVirtualAllocator::GetUsedBytes ( ) const
pure virtual

Member Data Documentation

◆ kInvalidOffset

constexpr uint64_t Foundation::RHI::RHIVirtualAllocator::kInvalidOffset = ~0ull
staticconstexpr

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