Aeon Engine c550894
AeonGames Open Source Game Engine
Loading...
Searching...
No Matches
AeonGames::VulkanBuffer Class Reference

Vulkan GPU buffer wrapper implementing the Buffer interface. More...

#include <C:/Code/AeonEngine/engine/renderers/vulkan/VulkanBuffer.hpp>

Inheritance diagram for AeonGames::VulkanBuffer:
Inheritance graph
Collaboration diagram for AeonGames::VulkanBuffer:
Collaboration graph

Public Member Functions

 VulkanBuffer (const VulkanRenderer &aVulkanRenderer)
 Construct an uninitialized buffer.
 VulkanBuffer (const VulkanRenderer &aVulkanRenderer, const VkDeviceSize aSize, const VkBufferUsageFlags aUsage, const VkMemoryPropertyFlags aProperties, const void *aData=nullptr)
 Construct and initialize a buffer with the given parameters.
 VulkanBuffer (VulkanBuffer &&)
 Move Constructor.
 VulkanBuffer (const VulkanBuffer &aBuffer)=delete
 Copy constructor.
VulkanBufferoperator= (const VulkanBuffer &aBuffer)=delete
 Assignment operator due to rule of zero/three/five.
VulkanBufferoperator= (VulkanBuffer &&)=delete
 Move Assignment.
void Initialize (const VkDeviceSize aSize, const VkBufferUsageFlags aUsage, const VkMemoryPropertyFlags aProperties, const void *aData=nullptr)
 Initialize the buffer with the given size, usage, memory properties, and optional data.
void Finalize ()
 Release the Vulkan buffer and its device memory.
const VkBuffer & GetBuffer () const
 Get the underlying Vulkan buffer handle.
Virtual functions
void WriteMemory (const size_t aOffset, const size_t aSize, const void *aData=nullptr) const final
 Write data into the buffer at a given offset.
void * Map (const size_t aOffset, size_t aSize) const final
 Map a region of the buffer into CPU-accessible memory.
void Unmap () const final
 Unmap a previously mapped buffer region.
size_t GetSize () const final
 Get the total size of the buffer in bytes.

Detailed Description

Vulkan GPU buffer wrapper implementing the Buffer interface.

Definition at line 25 of file VulkanBuffer.hpp.

Constructor & Destructor Documentation

◆ VulkanBuffer() [1/3]

AeonGames::VulkanBuffer::VulkanBuffer ( const VulkanRenderer & aVulkanRenderer)

Construct an uninitialized buffer.

Definition at line 28 of file VulkanBuffer.cpp.

◆ VulkanBuffer() [2/3]

AeonGames::VulkanBuffer::VulkanBuffer ( const VulkanRenderer & aVulkanRenderer,
const VkDeviceSize aSize,
const VkBufferUsageFlags aUsage,
const VkMemoryPropertyFlags aProperties,
const void * aData = nullptr )

Construct and initialize a buffer with the given parameters.

Definition at line 32 of file VulkanBuffer.cpp.

◆ VulkanBuffer() [3/3]

AeonGames::VulkanBuffer::VulkanBuffer ( VulkanBuffer && aBuffer)

Move Constructor.

Definition at line 54 of file VulkanBuffer.cpp.

◆ ~VulkanBuffer()

AeonGames::VulkanBuffer::~VulkanBuffer ( )

Definition at line 49 of file VulkanBuffer.cpp.

Member Function Documentation

◆ Finalize()

void AeonGames::VulkanBuffer::Finalize ( )

Release the Vulkan buffer and its device memory.

Definition at line 190 of file VulkanBuffer.cpp.

◆ GetBuffer()

const VkBuffer & AeonGames::VulkanBuffer::GetBuffer ( ) const

Get the underlying Vulkan buffer handle.

Definition at line 77 of file VulkanBuffer.cpp.

◆ GetSize()

size_t AeonGames::VulkanBuffer::GetSize ( ) const
finalvirtual

Get the total size of the buffer in bytes.

Returns
Buffer size in bytes.

Implements AeonGames::Buffer.

Definition at line 131 of file VulkanBuffer.cpp.

◆ Initialize()

void AeonGames::VulkanBuffer::Initialize ( const VkDeviceSize aSize,
const VkBufferUsageFlags aUsage,
const VkMemoryPropertyFlags aProperties,
const void * aData = nullptr )

Initialize the buffer with the given size, usage, memory properties, and optional data.

Definition at line 64 of file VulkanBuffer.cpp.

◆ Map()

void * AeonGames::VulkanBuffer::Map ( const size_t aOffset,
size_t aSize ) const
finalvirtual

Map a region of the buffer into CPU-accessible memory.

Parameters
aOffsetByte offset of the region to map.
aSizeNumber of bytes to map.
Returns
Pointer to the mapped memory region.

Implements AeonGames::Buffer.

Definition at line 105 of file VulkanBuffer.cpp.

◆ Unmap()

void AeonGames::VulkanBuffer::Unmap ( ) const
finalvirtual

Unmap a previously mapped buffer region.

Implements AeonGames::Buffer.

Definition at line 126 of file VulkanBuffer.cpp.

◆ WriteMemory()

void AeonGames::VulkanBuffer::WriteMemory ( const size_t aOffset,
const size_t aSize,
const void * aData = nullptr ) const
finalvirtual

Write data into the buffer at a given offset.

Parameters
aOffsetByte offset into the buffer to begin writing.
aSizeNumber of bytes to write.
aDataPointer to the source data, or nullptr to clear.

Implements AeonGames::Buffer.

Definition at line 82 of file VulkanBuffer.cpp.


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