|
Foundation
|
Thread-safe wrapper around VulkanMemoryAllocator's Virtual Allocator interface. More...
#include <VirtualAllocator.hpp>
Public Member Functions | |
| VirtualAllocator (size_t size, Allocator *alloc) | |
| Construct a VirtualAllocator instance. | |
| VirtualAllocation | Allocate (size_t size, size_t alignment) |
| Allocate memory of size and alignment. | |
| void | Free (VirtualAllocation handle) |
| Free a previous allocation. | |
| Pair< size_t, size_t > | Query (VirtualAllocation handle) |
| Query the offset and size of a previous allocation. | |
| size_t | QuerySize (size_t handle) |
| size_t | QueryOffset (size_t handle) |
| ~VirtualAllocator () | |
Private Attributes | |
| const size_t | mSize |
| VmaVirtualBlock | mBlock {} |
| Pool< VirtualAllocation, Tuple< size_t, size_t, VmaVirtualAllocation > > | mAllocs |
| Async::Mutex | mMutex |
Thread-safe wrapper around VulkanMemoryAllocator's Virtual Allocator interface.
You can use this to allocate offsets into a large GPU buffer, or even as a general purpose CPU memory allocator - the usage of the latter is discouraged in favor of HeapAllocator and StackAllocator
See also
Construct a VirtualAllocator instance.
| size | Size of the virtual memory arena |
| alloc | Allocator for virtual allocator state management |
| Foundation::Rendering::VirtualAllocator::~VirtualAllocator | ( | ) |
| VirtualAllocation Foundation::Rendering::VirtualAllocator::Allocate | ( | size_t | size, |
| size_t | alignment | ||
| ) |
Allocate memory of size and alignment.
| size | Size of the allocation |
| alignment | Alignment of the allocation |
| void Foundation::Rendering::VirtualAllocator::Free | ( | VirtualAllocation | handle | ) |
Free a previous allocation.
| handle | Previously acquired allocation from the same allocator through Allocate |
| Pair< size_t, size_t > Foundation::Rendering::VirtualAllocator::Query | ( | VirtualAllocation | handle | ) |
Query the offset and size of a previous allocation.
| handle | Previously acquired allocation from the same allocator through Allocate |
|
private |
|
private |
|
private |