Fling Engine  0.00.1
Fling Engine is a game engine written in Vulkan
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
Fling::Buffer Class Reference

A Buffer represents a Vulkan buffer with a size, buffer pointer, and buffer memory. More...

#include <Buffer.h>

Public Member Functions

 Buffer ()
 Default Ctor for a buffer. More...
 
 Buffer (const VkDeviceSize &t_Size, const VkBufferUsageFlags &t_Usage, const VkMemoryPropertyFlags &t_Properties, const void *t_Data=nullptr)
 Construct a new Buffer object. More...
 
 ~Buffer ()
 Destroy the Buffer object, frees Vk memory and destroys buffer. More...
 
const VkBuffer & GetVkBuffer () const
 
const VkDeviceMemory & GetVkDeviceMemory () const
 
const VkDeviceSize & GetSize () const
 
void Release ()
 Destroy the VK buffer object, frees vk memory. More...
 
bool IsUsed () const
 Check if this buffer's vulkan assets are used. More...
 

Static Public Member Functions

static void CopyBuffer (Buffer *t_SrcBuffer, Buffer *t_DstBuffer, VkDeviceSize t_Size)
 Copy the contents of the source buffer to the destintation buffer using a single command. More...
 

Private Member Functions

void MapMemory (void **t_Data) const
 Map the memory of this buffer to the given data. More...
 
void UnmapMemory ()
 Unmap this bufferes memory from the vulkan device. More...
 

Private Attributes

VkDeviceSize m_Size
 The size of this buffer in bytes. More...
 
VkBuffer m_Buffer
 Vulkan logical buffer object. More...
 
VkDeviceMemory m_BufferMemory
 Pointer to the physcial device memory for this buffer. More...
 

Detailed Description

A Buffer represents a Vulkan buffer with a size, buffer pointer, and buffer memory.

Constructor & Destructor Documentation

◆ Buffer() [1/2]

Fling::Buffer::Buffer ( )
inline

Default Ctor for a buffer.

Buffer is initalized to 0

◆ Buffer() [2/2]

Fling::Buffer::Buffer ( const VkDeviceSize &  t_Size,
const VkBufferUsageFlags &  t_Usage,
const VkMemoryPropertyFlags &  t_Properties,
const void *  t_Data = nullptr 
)

Construct a new Buffer object.

Parameters
t_SizeSize of this buffer in bytes
t_UsageVk usage flags for this buffer
t_PropertiesVk props of this buffer, used to find the memroy type
t_DataPointer to data that this buffer should map to, e.g. a staging buffer (Default = nullptr)

◆ ~Buffer()

Fling::Buffer::~Buffer ( )

Destroy the Buffer object, frees Vk memory and destroys buffer.

Member Function Documentation

◆ CopyBuffer()

void Fling::Buffer::CopyBuffer ( Buffer t_SrcBuffer,
Buffer t_DstBuffer,
VkDeviceSize  t_Size 
)
static

Copy the contents of the source buffer to the destintation buffer using a single command.

Parameters
t_SrcBufferSource buffer data
t_DstBufferDestination buffer data
t_SizeSize of the data to copy

◆ GetSize()

const VkDeviceSize& Fling::Buffer::GetSize ( ) const
inline

◆ GetVkBuffer()

const VkBuffer& Fling::Buffer::GetVkBuffer ( ) const
inline

◆ GetVkDeviceMemory()

const VkDeviceMemory& Fling::Buffer::GetVkDeviceMemory ( ) const
inline

◆ IsUsed()

bool Fling::Buffer::IsUsed ( ) const
inline

Check if this buffer's vulkan assets are used.

Returns
true memory is not null and the size is greater than 0

◆ MapMemory()

void Fling::Buffer::MapMemory ( void **  t_Data) const
private

Map the memory of this buffer to the given data.

Parameters
t_DataWhere to map this buffer's data to

◆ Release()

void Fling::Buffer::Release ( )

Destroy the VK buffer object, frees vk memory.

◆ UnmapMemory()

void Fling::Buffer::UnmapMemory ( )
private

Unmap this bufferes memory from the vulkan device.

Field Documentation

◆ m_Buffer

VkBuffer Fling::Buffer::m_Buffer
private

Vulkan logical buffer object.

◆ m_BufferMemory

VkDeviceMemory Fling::Buffer::m_BufferMemory
private

Pointer to the physcial device memory for this buffer.

◆ m_Size

VkDeviceSize Fling::Buffer::m_Size
private

The size of this buffer in bytes.


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