CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
CeresEngine::VKMemoryAllocation Class Referencefinal

#include <CeresEngine/RenderAPI/Vulkan/VKMemoryAllocator.hpp>

Public Member Functions

 VKMemoryAllocation ()
 
 VKMemoryAllocation (VKMemoryAllocator &allocator, const VkMemoryRequirements &memoryRequirements, VkMemoryPropertyFlags requiredFlags, VkMemoryPropertyFlags preferredFlags=0)
 
 ~VKMemoryAllocation ()
 
 VKMemoryAllocation (const VKMemoryAllocation &)=delete
 
VKMemoryAllocation & operator= (const VKMemoryAllocation &)=delete
 
 VKMemoryAllocation (VKMemoryAllocation &&) noexcept
 
VKMemoryAllocation & operator= (VKMemoryAllocation &&) noexcept
 
 operator bool () const
 
void bind (VkBuffer buffer)
 Binds the allocated memory to the given buffer.
 
void bind (VkImage image)
 Binds the allocated memory to the given ``.
 
VkDeviceMemory getDeviceMemory () const
 
VkDeviceSize getOffset () const
 
VkDeviceSize getSize () const
 
UInt32 getMemoryType () const
 
void * map ()
 Maps the memory.
 
void unmap ()
 Unmaps the memory.
 
void flush (VkDeviceSize offset=0, VkDeviceSize size=VK_WHOLE_SIZE)
 Flushes the cached memory data starting at offset with size bytes.
 
void invalidate (VkDeviceSize offset=0, VkDeviceSize size=VK_WHOLE_SIZE)
 Invalidates the cached memory data starting at offset with size bytes.
 

Protected Attributes

VKMemoryAllocator * allocator = nullptr
 The memory allocator.
 
VmaAllocation allocation = VK_NULL_HANDLE
 The Vulkan memory allocation.
 

Constructor & Destructor Documentation

◆ VKMemoryAllocation() [1/4]

CeresEngine::VKMemoryAllocation::VKMemoryAllocation ( )

◆ VKMemoryAllocation() [2/4]

CeresEngine::VKMemoryAllocation::VKMemoryAllocation ( VKMemoryAllocator &  allocator,
const VkMemoryRequirements &  memoryRequirements,
VkMemoryPropertyFlags  requiredFlags,
VkMemoryPropertyFlags  preferredFlags = 0 
)
explicit

◆ ~VKMemoryAllocation()

CeresEngine::VKMemoryAllocation::~VKMemoryAllocation ( )

◆ VKMemoryAllocation() [3/4]

CeresEngine::VKMemoryAllocation::VKMemoryAllocation ( const VKMemoryAllocation &  )
delete

◆ VKMemoryAllocation() [4/4]

CeresEngine::VKMemoryAllocation::VKMemoryAllocation ( VKMemoryAllocation &&  )
noexcept

Member Function Documentation

◆ bind() [1/2]

void CeresEngine::VKMemoryAllocation::bind ( VkBuffer  buffer)

Binds the allocated memory to the given buffer.

Parameters
bufferThe buffer to bind the memory to

◆ bind() [2/2]

void CeresEngine::VKMemoryAllocation::bind ( VkImage  image)

Binds the allocated memory to the given ``.

Parameters
imageThe to bind the memory to

◆ flush()

void CeresEngine::VKMemoryAllocation::flush ( VkDeviceSize  offset = 0,
VkDeviceSize  size = VK_WHOLE_SIZE 
)

Flushes the cached memory data starting at offset with size bytes.

Parameters
offsetThe starting offset to be flushed
sizeThe amount of bytes to be flushed

◆ getDeviceMemory()

VkDeviceMemory CeresEngine::VKMemoryAllocation::getDeviceMemory ( ) const
Returns
The Vulkan device memory object

◆ getMemoryType()

UInt32 CeresEngine::VKMemoryAllocation::getMemoryType ( ) const
Returns
The allocated memory type

◆ getOffset()

VkDeviceSize CeresEngine::VKMemoryAllocation::getOffset ( ) const
Returns
The allocated memory offset within the deviceMemory.

◆ getSize()

VkDeviceSize CeresEngine::VKMemoryAllocation::getSize ( ) const
Returns
The allocated memory size within the deviceMemory.

◆ invalidate()

void CeresEngine::VKMemoryAllocation::invalidate ( VkDeviceSize  offset = 0,
VkDeviceSize  size = VK_WHOLE_SIZE 
)

Invalidates the cached memory data starting at offset with size bytes.

Parameters
offsetThe starting offset to be flushed
sizeThe amount of bytes to be flushed

◆ map()

void * CeresEngine::VKMemoryAllocation::map ( )

Maps the memory.

Returns
A pointer to the memory mapped buffer

◆ operator bool()

CeresEngine::VKMemoryAllocation::operator bool ( ) const
inlineexplicit
Returns
true if the memory is allocated.

◆ operator=() [1/2]

VKMemoryAllocation & CeresEngine::VKMemoryAllocation::operator= ( const VKMemoryAllocation &  )
delete

◆ operator=() [2/2]

VKMemoryAllocation & CeresEngine::VKMemoryAllocation::operator= ( VKMemoryAllocation &&  )
noexcept

◆ unmap()

void CeresEngine::VKMemoryAllocation::unmap ( )

Unmaps the memory.

Member Data Documentation

◆ allocation

VmaAllocation CeresEngine::VKMemoryAllocation::allocation = VK_NULL_HANDLE
protected

The Vulkan memory allocation.

◆ allocator

VKMemoryAllocator* CeresEngine::VKMemoryAllocation::allocator = nullptr
protected

The memory allocator.


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